如何在gridview中获取列索引值 [英] How to get the column index value in gridview

查看:135
本文介绍了如何在gridview中获取列索引值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的gridview有autogeneratecolumns = true,我想获取用户点击gridview单元格的特定列索引值。如果用户点击第三行,第五列的单元格,那么它将显示第三行和第三列的标题文本。第五栏。如何获取特定列索引值。请帮帮我。



My gridview has autogeneratecolumns = true and I want to get the specific column index value of where the user click on the gridview cell. If the user clicks on the cell of third row, fifth column, then it will show the Header text of Third Row & Fifth Column. How can I get the specific column index value. Please help me out.

protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
    Label1.Text = "RowHeader - " + GridView1.SelectedRow.Cells[0].Text + " and ColumnHeader - " + GridView1.HeaderRow.Cells[0].Text;
}

推荐答案

最后我使用下面的jQuery做了这个......



Finally I did this using the below jQuery...

<script type="text/javascript">


(document).ready(function(){
(document).ready(function () {


('#GridView1> tbody> tr> td')。click(function(){
var col =
('#GridView1>tbody>tr>td').click(function () { var col =


这篇关于如何在gridview中获取列索引值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆