hi everyone!
i have the follow question! Can i load dynamically a Ultra Web Menu (or other web controls) into a Group instead of using items ?
my objective is to create a menu where the Groups in ListBar are the root Nodes and the items in ultra web menu are the child nodes.
if i have 5 groups then i will have 5 ultra web menus.
using design and adding them statically i can achieve this with <template></template> so i think it can be done with code!
any help would be appreciated.
Thanks,
Paulo Pereira
HI Paulo,
you can add a user control to a group template.
here is a code snippet:
In Visual Basic:
Me.UltraWebListbar2.Groups.FromKey("Group3").UserControlUrl = "ucSearch.ascx"
Me
In C#:
this.UltraWebListbar1.Groups.FromKey("Group0").UserControlUrl = "ucSearch.ascx";
this
Here is a help link on how to place a User control on a Group Template:
http://help.infragistics.com/Help/NetAdvantage/NET/2008.1/CLR2.0/html/WebListbar_Place_a_User_Control_on_a_Group_Template.html
Ok, thks for helping, Matt
but i actually made it different ...
I started to create a class that implements ITemplate () wich overrides a method called InstantiateIn(ByVal control As Control).
In that method i created the control dynamically and at the end of method simply added it with control.Controls.add(mycontrol)
then just associate the instance of the class that implements ITemplate to UltraWebListBar.Groups(i).Template property
Public Class MyTemplate Implements ITemplate
Public Sub New() End Sub
End Sub
Public Overridable Overloads Sub InstantiateIn(ByVal control As Control) Implements ITemplate.InstantiateI Dim txtBox As New TextBox txtBox.ID = "txtBox1" 'here you can add your controls you like control.Controls.Add(txtBox) End Sub
Public Overridable Overloads Sub InstantiateIn(ByVal control As Control) Implements ITemplate.InstantiateI
Dim txtBox As New TextBox txtBox.ID = "txtBox1" 'here you can add your controls you like control.Controls.Add(txtBox)
txtBox.ID = "txtBox1"
'here you can add your controls you like
control.Controls.Add(txtBox)
End Class
Assocciate instance with Template property:
Dim group As Infragistics.WebUI.UltraWebListbar.Group = UltraWebListbar1.Groups.Add("TitleGroup")
group.Template = template