viv verma

viv verma

  • NA
  • 163
  • 35.3k

how to get value Table's or Gridvie tr td from Jquery,

Nov 19 2016 10:26 AM
<script type="text/javascript">
function mainCall() {
var lb = document.getElementById('gvlblName').innerHTML;
alert(lb);
var name = $(obj).closest('tr').find('td:eq(0)').text();
alert(name);
}
</script>
===============================
<asp:GridView ID="grdRegister" runat="server" AutoGenerateColumns="false" >
<Columns>
<asp:TemplateField HeaderText="UserName">
<ItemTemplate>
<a href="#" id="na" onclick="mainCall();" >
<asp:Label ID="gvlblName" runat="server" text='<%#Eval("UserName")%>'></asp:Label>
</a>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
======================================================== 
error popup : The name 'gvlblName' does not exist in the current context
error popup : undefiend

Answers (1)