Riddhi Valecha

Riddhi Valecha

  • 444
  • 3.3k
  • 411.7k

GridView - Get Column Header + Button Link- RowCommand

Jul 2 2015 11:55 PM
Hi all...
 
I need help in GridView Binding -
 
My GridView Design in aspx page is -
 
<asp:GridView ID="grd_Data" runat="server" AutoGenerateColumns="false">
<Columns>
<asp:ButtonField DataField="N" HeaderText="EName" />  
<asp:ButtonField DataField="C" HeaderText="ECode" />
<asp:ButtonField DataField="D" HeaderText="EDept" />
 <asp:ButtonField DataField="S" HeaderText="ESal" />
</Columns>
</asp:GridView>
--------
Now - THe columns - ECode ; EDept and ESal - are all numeric.
 
I want a logic that -
When I click on any number of any column (ECode ; EDept; ESal) ; I want its corresponding Headertext and  Datafield in CS Page - In RowCommand Event.
 
i.e. - Get corresponding column header text of selected value.
 
Also, WHere ever the number is 0(zero); the user should not be able to click the number.
 
How to achieve this ??
 
PLease guide
 

Answers (3)