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
3760
Dynamically created template not associated to item
posted

Is there some sample code available for creating a WebExplorerBar template, group and item dynamically? Or hopefully, I am missing something simple?I had this working when configured in the markup but I need to create them dynamically. Although the code runs and I can access the webdatatree from within the template, a call to WebExplorerBar1.group(0).item(0).FindControl("TemplateTest") does not return an object and even when I add nodes to webdatatree in the template, they do not show. I has hoping that as long as the templateid for the item matched the templateid of the template then they would be associated (as happens in the markup) but this is not happening. The below example code is being tested in the page_load.

 
        Dim newGroup As New ExplorerBarGroup
        Dim newItem As New ExplorerBarItem

        newGroup = New ExplorerBarGroup
        newGroup.Text = "Group Text"
        newGroup.Value = "Group Value"

        newItem = New ExplorerBarItem
        newItem.TemplateId = "TemplateTest"


        newGroup.Items.Add(newItem)

        WebExplorerBar1.Groups.Add(newGroup)


        Dim ExplorerBarTemplate As New ItemTemplate

        Dim wdt As New Infragistics.Web.UI.NavigationControls.WebDataTree

        wdt.ID = "Test Tree"

        ExplorerBarTemplate.ID = "Template ExplorerBar"
        ExplorerBarTemplate.TemplateID = "TemplateTest"
        ExplorerBarTemplate.Controls.Add(wdt)

        WebExplorerBar1.Templates.Add(ExplorerBarTemplate)