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)
Hi,
Thanks very much, yes, I am working on implementing this now and what I have done so far seems to be working.
I did try to have a server side event (NodeClick) by obtaining a reference to the webdatatree (which worked) and using it with addhandler. This worked fine when the controls were created in the markup but not when created this way. Do you know if this should work? (If not it might be that we can get away with just client side events)
Regards,
Andrew
Hello,
I am following up to see if the information and sample provided has resolved this matter.
Please let me know if I may be of further assistance with this matter.
Sincerely,Mike P.Developer Support EngineerInfragistics, Inc.www.infragistics.com
Thank you for your patience. I have created and am attaching a sample to demonstrate how to achieve this behavior. To do this you will want to create the item or group you are creating as a template in the Page PreInit. To demonstrate accessing the control ad modifying it I use the button click event.
Please let me know if you have any questions concerning this matter.
I am working on a sample to demonstrate this behavior. I have run into some difficulty in creating this sample, I have been able to get the ITemplate to display with a WebDataTree in it created in the code behind. I have been unable to access the control in the template to add nodes to it. I am going to consult with my Team Lead concerning this matter and will provide you with a progress update by Thursday.
Thank you for your patience. I have done some research into this matter and I believe when you want to create template items on the server side this should be done by using the ITemplate. I am working on a sample to demonstrate this behavior, it is taking longer than I had originally expected. I will continue to work on this matter and will give you a progress update by Monday.