在 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
?
How Can I get rowIndex
on row command event?
我想在 RowCommand
触发时突出显示 (select
) 目标行.
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屋!
查看全文