嵌套的网格视图行值



我有这个代码:

 <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:在函数 void Test() 中,我想从 gridview2 的每一行中获取值。我尝试了findcontrol方法,但我认为不可能找到BoundField。我该怎么做?

在类似的论坛上找到了灵魂。

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

相关内容

  • 没有找到相关文章

最新更新