Try this sample code..
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="RequestNo" OnRowCommand="GridView1_RowCommand">
<Columns>
<asp:ButtonField CommandName="Update" Text="Approve" ButtonType="Button" />
<asp:ButtonField ButtonType="Button" Text="Disapprove" />
<asp:BoundField DataField="RequestNo" HeaderText="RequestNo" InsertVisible="False"
ReadOnly="True" SortExpression="RequestNo" />
<asp:BoundField DataField="Date" HeaderText="Date" SortExpression="Date" />
<asp:BoundField DataField="FullName" HeaderText="FullName" ReadOnly="True" SortExpression="FullName" />
<asp:BoundField DataField="Position" HeaderText="Position" SortExpression="Position" />
<asp:BoundField DataField="Department" HeaderText="Department" SortExpression="Department" />
<asp:BoundField DataField="Section" HeaderText="Section" SortExpression="Section" />
<asp:BoundField DataField="Employee" HeaderText="Employee" SortExpression="Employee" />
<asp:BoundField DataField="Request" HeaderText="Request" SortExpression="Request" />
<asp:BoundField DataField="Status" HeaderText="Status" SortExpression="Status" />
<asp:BoundField DataField="Comment" HeaderText="Comment" SortExpression="Comment" />
<asp:BoundField DataField="Account" HeaderText="Account" SortExpression="Account" />
</Columns>
</asp:GridView>
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Update")
{
int index = Convert.ToInt32(e.CommandArgument);
GridViewRow row = GridView1.Rows[index];
string requestNo = row.Cells[2].Text;
}
if (e.CommandName == "")
{ }
}
This code will give you an idea ..
have a look at the belows links to better work through...
link
[
^]
link
[
^]