获取Asp.net Rowcommand事件行索引 [英] Get Row Index on Asp.net Rowcommand event
本文介绍了获取Asp.net Rowcommand事件行索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个asp.net的GridView。结果
I have an asp.net Gridview.
<asp:TemplateField HeaderText="View Faktor" ShowHeader="False" Visible="True">
<ItemTemplate>
<asp:ImageButton ID="imgBtn1" CssClass="SelectRow" runat="server" CausesValidation="false"
CommandArgument='<%#(eval("mprID")) %>' CommandName="ViewFactors" ImageUrl="~/tadarokat/Images/factor.png"
Text="" />
</ItemTemplate>
</asp:TemplateField>
我怎样才能获得的rowIndex上排命令事件?
结果我想强调(选择)目标行时Rowcommand火灾。
How Can I get rowIndex on row command event?
I want to highlight (select) target row when Rowcommand fires.
推荐答案
这是回答你的问题。
GridViewRow gvr = (GridViewRow)(((ImageButton)e.CommandSource).NamingContainer);
int RowIndex = gvr.RowIndex;
这篇关于获取Asp.net Rowcommand事件行索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文