C# 使用数据表的嵌套中继器

C# 使用数据表的嵌套中继器,c#,datatable,repeater,asprepeater,C#,Datatable,Repeater,Asprepeater,我无法使用datatable正确绑定我的子中继器(lvTwo)。它总是抛出NullReferenceException。在调试模式下,我的数据表看起来很好,有什么想法吗 HTML代码: <asp:Repeater ID="lvOne" runat="server" OnItemDataBound="lvOne_ItemDataBound"> <ItemTemplate> <div> I am the one.

我无法使用datatable正确绑定我的子中继器(lvTwo)。它总是抛出NullReferenceException。在调试模式下,我的数据表看起来很好,有什么想法吗

HTML代码:

<asp:Repeater ID="lvOne" runat="server" OnItemDataBound="lvOne_ItemDataBound">
    <ItemTemplate>
        <div>
            I am the one.
        </div>
        <asp:Repeater ID="lvTwo" runat="server">
            <ItemTemplate>
                I am the two.
            </ItemTemplate>
        </asp:Repeater>
    </ItemTemplate>
</asp:Repeater>

罪魁祸首是由于未被识别的lvTwo控制。由于控件注册在设计器文件中,因此它能够编译,而我需要使用ff:

var lvTwo = (ListView) e.Item.FindControl("lvTwo");

检查是否已初始化lvOne或lvTwo。。此外,从何处引发异常?
var lvTwo = (ListView) e.Item.FindControl("lvTwo");