如何获取选择的列HeaderText(CommandField)

问题描述:

嗨..
我正在使用ASP.net Web应用程序.
因为我有gridview.
在网格视图中,我正在使用两个/那里CommandFields

一旦我单击CommandField1/CommandField2 ...,我必须知道列标题是什么.


我举个例子.
我正在使用vb

Hi..
I am using ASP.net web application.
in that i have gridview.
In grid view i am using two / there CommandFields

once i click on CommandField1/CommandField2... i have to know what is that column headtext.


i am giving example.
i am using vb

<asp:HyperLinkField HeaderText="Plan1" Text="Plan1" NavigateUrl="~/PlanPopup1.aspx" Visible="False" /> <asp:CommandField ShowSelectButton="True" HeaderText="Plan1" SelectText="Plan1"/>

<asp:HyperLinkField HeaderText="Plan2" Text="Plan2" NavigateUrl="~/PlanPopup1.aspx" Visible="False" />
<asp:CommandField ShowSelectButton="True" HeaderText="Plan2" SelectText="Plan2"/>


在这个我有两个commandFields.也就是说,一旦我单击plan1列,我就是plan1和plan2.我应该得到plan1标头文本.


In this i have two commandFields. i.e is plan1 and plan2 once i click on plan1 column i should get the plan1 header text.

有一个对象传递给您的事件.检查它是什么,也许您可​​以对其进行投射以找出它是哪个按钮(应该可以).还要检查事件中的eventargs,如果它不是EventArgs,而是派生类,则派生为您提供您想要的信息.
There''s an object passed in to your event. Check what it is, perhaps you can cast it to work out which button it was ( you should be able to ). Also check the eventargs on the event, if it''s not an EventArgs, but a derived class, it''s derived to give you the info you want.