nested gridview row values

875 views Asked by At

I have this code:

 <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" OnRowDataBound="something">
        <Columns>
            <asp:TemplateField >
                <ItemTemplate>
                    <asp:Panel ID="Panel1" runat="server" Style="display: none" >
                        <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" ShowHeader="False">
                            <Columns>
 <asp:BoundField DataField="NAME"></asp:BoundField>
                              other  asp-BoundFields...
                            </Columns>
                        </asp:GridView>
                    </asp:Panel>
                </ItemTemplate>
            </asp:TemplateField>
             asp-BoundFields...
        </Columns>
</asp:GridView>

CS: In function void Test() I want to get values from each row of gridview2. I tried with findcontrol method, but I think it is not possible to find BoundField. How can I do that?

1

There are 1 answers

0
michael24B On BEST ANSWER

Found soultion on similar forum.

    GridView Gridview2 = (GridView)GridView1.Rows[1].FindControl("GridView2");