点击页脚中的按钮时,如何检查HeaderText
或ColumnIndex
或点击的列?
GRIDVIEW
<asp:GridView ID="gv" runat="Server" ShowFooter="true">
<Columns>
<asp:TemplateField HeaderText="1">
<ItemTemplate></ItemTemplate>
<FooterTemplate>
<asp:LinkButton ID="btnSubmit1" runat="server" CommandName="Submit1">SUBMIT</asp:LinkButton>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="2">
<ItemTemplate></ItemTemplate>
<FooterTemplate>
<asp:LinkButton ID="btnSubmit2" runat="server" CommandName="Submit2">SUBMIT</asp:LinkButton>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="3">
<ItemTemplate></ItemTemplate>
<FooterTemplate>
<asp:LinkButton ID="btnSubmit3" runat="server" CommandName="Submit3">SUBMIT</asp:LinkButton>
</FooterTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
VB.NET
Private Sub gv_RowCommand(sender As Object, e As GridViewCommandEventArgs) Handles gv.RowCommand
If e.CommandName = "Submit1" Then
'GET CLICKED BUTTON
Dim Button = TryCast(e.CommandSource, LinkButton)
'GET CLICKED ROW
Dim Row = TryCast(Button.NamingContainer, GridViewRow)
'GET CLICKED COLUMN
'?
'GET CLICKED COLUMN HEADER TEXT
'?
End If
End Sub
答案 0 :(得分:0)
列已由命令名
确定Dim Column As String = sender.Columns(0).HeaderText