Here, I have created sample code that will help you
HTML
<asp:GridView ID="gvCustomers" runat="server" AutoGenerateColumns="false" CssClass="Grid"
DataKeyNames="CustomerID" OnRowDataBound="OnRowDataBound">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<img alt="" style="cursor: pointer" src="images/plus.png" />
<asp:Panel ID="pnlOrders" runat="server" Style="display: none">
<asp:GridView ID="gvOrders" runat="server" AutoGenerateColumns="false" CssClass="ChildGrid"
OnRowCommand="gvOrders_RowCommand">
<Columns>
<asp:BoundField ItemStyle-Width="150px" DataField="OrderId" HeaderText="Order Id" />
<asp:BoundField ItemStyle-Width="150px" DataField="OrderDate" HeaderText="Date" />
<asp:TemplateField>
<ItemTemplate>
<asp:Button Text="Download" runat="server" CommandName="SupDocDownload" CommandArgument='<%# Container.DataItemIndex %>' />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</asp:Panel>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField ItemStyle-Width="150px" DataField="ContactName" HeaderText="Contact Name" />
<asp:BoundField ItemStyle-Width="150px" DataField="City" HeaderText="City" />
</Columns>
</asp:GridView>
C#
protected void gvOrders_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "SupDocDownload")
{
int index = int.Parse(e.CommandArgument.ToString());
GridViewRow childCurrentrow = (sender as GridView).Rows[index];
GridViewRow parentCurrentRow = (sender as GridView).NamingContainer as GridViewRow;
string orderId = childCurrentrow.Cells[0].Text;
string orderDate = childCurrentrow.Cells[1].Text;
string contactName = parentCurrentRow.Cells[1].Text;
string city = Server.HtmlDecode(parentCurrentRow.Cells[2].Text);
}
}
VB
Protected Sub gvOrders_RowCommand(sender As Object, e As GridViewCommandEventArgs)
If e.CommandName = "SupDocDownload" Then
Dim index As Integer = Integer.Parse(e.CommandArgument.ToString())
Dim childCurrentrow As GridViewRow = TryCast(sender, GridView).Rows(index)
Dim parentCurrentRow As GridViewRow = TryCast(TryCast(sender, GridView).NamingContainer, GridViewRow)
Dim orderId As String = childCurrentrow.Cells(0).Text
Dim orderDate As String = childCurrentrow.Cells(1).Text
Dim contactName As String = parentCurrentRow.Cells(1).Text
Dim city As String = Server.HtmlDecode(parentCurrentRow.Cells(2).Text)
End If
End Sub
I hope this code help you.