如何访问转发器内部的转发器内的网格视图(嵌套转发器)

时间:2012-04-11 16:37:56

标签: asp.net vb.net repeater

如何访问rep_DataSimilarToBacthid

我需要绑定GridView并调用GridView RowDataBound或InitializeRow

<asp:Repeater ID="rep_UnAssignComps" runat="server">

                 <ItemTemplate>
         <asp:Repeater ID="rep_UnAssignComps" runat="server">

                 <ItemTemplate>
                    <asp:GridView ID="rep_DataSimilarToBacthid" runat="server" Style="text-align: center;
                        width: 375px;" AutoGenerateColumns="false">
                        <Columns>
                            <asp:BoundField HeaderText="Test" DataField="Test" />
                        </Columns>

                    </asp:GridView>
        </ItemTemplate>
    </asp:Repeater>
            </ItemTemplate>
        </asp:Repeater>

我正在使用VB.Net和Framework Version 2.0。感谢

1 个答案:

答案 0 :(得分:2)

在你的代码后面添加这样的功能:

Protected Sub grid_RowDataBound(sender As Object, e As GridViewRowEventArgs)

End Sub

对你的GridView控件添加OnRowDataBound =“grid_RowDataBound”,你得到:

<asp:GridView ID="rep_DataSimilarToBacthid" runat="server" OnRowDataBound="grid_RowDataBound" ...