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?
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.
Hallo!
Thank you for your response.
My CompositeControl acts like a framwork for formal pages. It consists of a tree, an iframe and a tasklist. Because of only loading new pages into the iframe, i have to change the body attributes "onload" and "onunload" a few times during the livecircle of my session (as the "hosted" site likes).Therefor I need runat="server".
Me.Page.Form.Controls.Add()
It does not depend on any other controls and I let vb do the work for finding my form-tag.