0

我有这个代码:

 <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。我怎样才能做到这一点?

4

1 回答 1

0

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

    GridView Gridview2 = (GridView)GridView1.Rows[1].FindControl("GridView2");
于 2014-01-04T16:03:41.960 回答