本文介绍了将文本框值放在gridview的所有行中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞!<html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title></title> <script type = "text/javascript"> function setAutoComplete() { var textBoxes = document.getElementsByClassName("AutoCompleteTextBox"); for (var i = 0; i < textBoxes.length; i++) { addAutoComplete(textBoxes[i].id); } } function addAutoComplete(hfUserId) { $("#" + hfUserId).autocomplete({ source: function (request, response) { $.ajax({ url: '<%=ResolveUrl("~/Service.asmx/GetUserNames") %>', data: "{ 'prefix': '" + request.term + "'}", dataType: "json", type: "POST", contentType: "application/json; charset=utf-8", success: function (data) { response($.map(data.d, function (item) { return { label: item.split('-')[0], val: item.split('-')[1] } })) }, error: function (response) { alert(response.responseText); }, failure: function (response) { alert(response.responseText); } }); }, select: function (e, i) { $("#<%=hfUserId.ClientID %>").val(i.item.val); }, minLength: 1 }); }; { $(document).ready(function () { setAutoComplete(); }); } </script></head><body> <form id="form1" runat="server"> <div> <asp:TextBox ID="hfUserId" runat="server"></asp:TextBox> <asp:GridView ID="GridView1" runat="server" AllowPaging="True" DataSourceID="SqlDataSource1" AutoGenerateColumns="False"> <Columns> <asp:TemplateField ItemStyle-Width="150px" HeaderText="Challan No"> <ItemTemplate> <asp:TextBox ID="txt_UID" runat="server" Text='<%# Eval("ChallanNo")%>' CssClass="AutoCompleteTextBox" Width="130px" BackColor="LightGoldenrodYellow"></asp:TextBox> </ItemTemplate> <ItemStyle Width="150px" /> </asp:TemplateField> </Columns> </asp:GridView> </div> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:AmitPandeyConnectionString %>" SelectCommand="SELECT [ChallanNo] FROM [CreateDocket]"></asp:SqlDataSource> </form> <script type = "text/javascript"> $(document).ready(function () { $.each($(".AutoCompleteTextBox"), function (i, textBox) { textBox.autocomplete(txt_UID); }) }); </script></body></html> 我想要做的是我想将textbox(hfUserId)的值放入我所有行的gridview文本框(txt_UID)中gridview中的更多条目但我删除了它们的行数由其他行决定What I want to Do is I want to put the value of textbox(hfUserId) into the gridview textbox(txt_UID) in all rows I have more entries n the gridview but I have removed them The no of rows are decide by the other rows推荐答案 这篇关于将文本框值放在gridview的所有行中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 09-06 00:45