Jquery 如何在asp.net中点击获取gridview的单元格索引

Jquery 如何在asp.net中点击获取gridview的单元格索引,jquery,asp.net,Jquery,Asp.net,我正在尝试这段代码,但在隐藏字段中,它总是显示空值 $('#gvshowreport>tbody>tr>td').click(function () { var col = $(this).parent().children().index($(this)); var title = $(this).closest("table").find("th").eq(col).text(); $('#<%= HiddenField1.ClientID %>').va

我正在尝试这段代码,但在隐藏字段中,它总是显示空值

$('#gvshowreport>tbody>tr>td').click(function () {

var col = $(this).parent().children().index($(this));

var title = $(this).closest("table").find("th").eq(col).text();

$('#<%= HiddenField1.ClientID %>').val(title);

$('#<%= HiddenField2.ClientID %>').val(col);

您想要行索引吗?我需要单击GridView的特定单元格时的列索引检查这是否有用。@Aishvarya代码将获取行索引。此外,我没有使用boundfield,因为列将从数据库动态绑定
 string headerRowText = HiddenField1.Value;

 string s = HiddenField2.Value;