Its Simple , You need to call the Gridveiw Row Command Event Handler
See first convert the button as Template Column , as shown below and give it a command Name as shown below
<asp:TemplateField HeaderText="Actions" meta:resourcekey="TemplateFieldResource9"> <ItemTemplate>
<asp:ImageButton ID="imgView" ImageUrl="~/Images/View.gif" runat="server" CommandName="ViewIssueDetails" CommandArgument='<%# Eval("ISSUEID") %>' ToolTip="View Issue Details" />
</ItemTemplate> </asp:TemplateField>
Now call the below method
protected void gvTask_OnRowCommand(Object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "ViewIssueDetails")
{
GridViewRow row;
row = (GridViewRow)((Control)e.CommandSource).NamingContainer;
}
}
GridviewRow Row , you can read the value of each columns of Grdiveiw and can display it as per your requirement
Make sure your Gridview has tagged to following command
<asp:GridView ID="gvMyTask" runat="server" Width="100%"OnRowCommand="gvTask_OnRowCommand" OnPageIndexChanging="gvTask_PageIndexChanging" AllowPaging="True" AutoGenerateColumns="False">