ASP.Net DataGrid的行索引 [英] Row index for ASP.Net datagrid
本文介绍了ASP.Net DataGrid的行索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
亲爱的朋友,
我需要获取一个asp.net网格的行索引,并将该rowindex传递给方法.但是我无法在datagrid中的复选框的CheckedChanged事件上获取网格的行索引. :(.
请帮帮我.
谢谢
Varun Sareen
Dear Friends,
I need to fetch the row index of a asp.net grid and pass that rowindex into a method. But i am not able to fetch the row index of the grid on the CheckedChanged event of a checkbox in datagrid. :( .
Please help me.
Thanks
Varun Sareen
推荐答案
简单来说,
您可以在gridview的模板字段中编写复选框.
然后在您的复选框字段中输入命令名称.
那么您可以使用gridview的rowcommand事件,在该事件中
您可以在给定的命令名称下使用row.rowindex属性:omg:
Simply,
you can write checkbox in template field of gridview.
then give command name to your checkbox field.
then you can use rowcommand event of gridview and in that
u can use row.rowindex property under your given command name :omg:
我认为您可以从事件处理程序参数中以object sender
形式获得的CheckBox反向工作,找到GridViewRow并从那里获取索引.通过导航CheckBox的.Parent
属性以及所有包含的控件,您将进入GridViewRow.
I think you could work backwards from the CheckBox you get asobject sender
in the event handler parameters, find the GridViewRow and get the index from there. by navigating up the.Parent
property of the CheckBox and any containing controls you will get to the GridViewRow.
这篇关于ASP.Net DataGrid的行索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文