Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
390
tree in composite control with body runat="server" not working
posted

Hello!

I have a composite control with a tree in it:

            Dim infraTree As Infragistics.WebUI.UltraWebNavigator.UltraWebTree
            infraTree = createInfraTree()
            Dim refreshTree As New Infragistics.WebUI.Misc.WebAsyncRefreshPanel
            refreshTree.ID = "Page42.refreshTree"

            Page.Controls.Item(3).Controls.Add(treeOpenDiv)
            Page.Controls.Item(3).Controls.Add(refreshTree)
            Page.Controls.Item(3).Controls.Add(treeCloseDiv)

Page.Controls.Item(3) is the form of the page.

If I change the runat proporty of the body for the page, including my composite control to true, the tree is shown completely collapsed, and I can't expand any nodes.

 Any suggestions?

Parents
  • 28464
    posted

    Using hard-coded indices and Items directly may interfere with how the page places controls in their respective collections. I can recommend adding the composite control instance directly to the form using: 

    Page.Form.Controls.Add(myCompositeControl); 

    Or better yet, to a placeholder on the page on then directly to the placeholder controls collection:

    <body>
        <form id="form1" runat="server">
            <asp:PlaceHolder runat="server" ID="TreeViewPlaceHolder"></asp:PlaceHolder>
        </form>
       
    </body>

    TreeViewPlaceHolder.Controls.Add(myCompositeControl);

    Also, why do you need adding the runat attribute to the body of the page? This is typically not a best-practive in ASP.NET sites.

Reply Children