如何获取当前行控件ID';将光标文本框放置在gridview asp.net中时是否在jquery中?
在GridView asp.net中放置光标文本框时,如何在jQuery中获取当前行控件ID如何获取当前行控件ID';将光标文本框放置在gridview asp.net中时是否在jquery中?,jquery,asp.net,gridview,Jquery,Asp.net,Gridview,在GridView asp.net中放置光标文本框时,如何在jQuery中获取当前行控件ID $(document).ready(function () { $('.Text_Controls_Focus').focus(function () { $(document).ready(function () { $('.Text_Controls_Focus').focus(function () { // N
$(document).ready(function () {
$('.Text_Controls_Focus').focus(function () {
$(document).ready(function () {
$('.Text_Controls_Focus').focus(function () {
// Need To Get ID of Current Row Of Griview and
// Griview ID
$(this).dialog('close');
}
},
modal: true
});
简言之,ID为
txtFirstName
的Web控件可以呈现为具有客户端ID的HTML元素,如“ctl00\u MainContent\u txtFirstName”
。ASP.NET GridView(gdRows
)也是如此,例如:
假设GridView中有TextBox和Label控件
<ItemTemplate>
<asp:TextBox ID="txtID" runat="server" />
<asp:Label ID="lblID" runat="server" />
</ItemTemplate>
简言之,ID为txtflastname
的Web控件可以呈现为具有客户端ID的HTML元素,如“ctl00\u MainContent\u txtflastname”
。ASP.NET GridView(gdRows
)也是如此,例如:
假设GridView中有TextBox和Label控件
<ItemTemplate>
<asp:TextBox ID="txtID" runat="server" />
<asp:Label ID="lblID" runat="server" />
</ItemTemplate>
谢谢。。。我尝试一些替代的解决方案。。。这个解决方案简化了我的逻辑。再次感谢。谢谢。。。我尝试一些替代的解决方案。。。这个解决方案简化了我的逻辑。再次感谢。
// select all Labels in GridView
$('#<%=gdRows.ClientID %>').find('span[id$="lblID"]').text('Your text.');
// select a particular Label in GridView
var $arrL = $('#<%=gdRows.ClientID %>').find('span[id$="lblID"]');
var $lbl = $arrL[0]; // finds a Label at 0 index
$($lbl).text('Your text...');
// select all TextBoxes in GridView
$('#<%=gdRows.ClientID %>').find('input:text[id$="txtID"]').val('Your value.');
// select a particular TextBox in GridView
var $arrL = $('#<%=gdRows.ClientID %>').find('input:text[id$="txtID"]');
var $txt = $arrL[0]; // finds a TextBox at 0 index
$($txt).text('Your text...');