we can add items to ultraweblist directly if items are static is as follows.
<iglbar:UltraWebListbar ID=”UltraWebListbar1″ runat=”server” BorderWidth=”4px” Height=”350px”
ViewType=”ExplorerBar” Width=”236px” BarWidth=”100%” BorderStyle=”None” GroupSpacing=”5px”
ItemIconStyle=”SmallWithInsetText” MergeStyles=”True” HeaderClickAction=”ExpandOnClick”>
<Groups>
<iglbar:Group Text=”&nbsp;Module1″ TextAlign=”Left”>
<Labels Collapsed=”" Expanded=”" Selected=”" />
<Items>
<iglbar:Item Text=”<img src=’images/image1.gif’ alt=” height=’22px’ width=’22px’ /> Sub Module 1″ TargetUrl=”page1.aspx”>
<Labels Selected=”" />
</iglbar:Item>
<iglbar:Item Text=”<img src=’images/image2.gif’ alt=” height=’22px’ width=’22px’ /> Sub Module 2″ TargetUrl=”page2.aspx”>
<Labels Selected=”" />
</iglbar:Item>
<iglbar:Item Text=”<img src=’images/image3.jpg’ alt=” height=’22px’ width=’22px’ /> Sub Module 3″ TargetUrl=”page3.aspx”>
<Labels Selected=”" />
</iglbar:Item>
<iglbar:Item Text=”<img src=’images/image4.jpg’ alt=” height=’22px’ width=’22px’ /> Sub Module 4″ TargetUrl=”page4.aspx”>
<Labels Selected=”" />
</iglbar:Item>
</Items>
</iglbar:Group>
<iglbar:Group Text=”&nbsp;Module2″ TextAlign=”Left”>
<Labels Collapsed=”" Expanded=”" Selected=”" />
<Items>
<iglbar:Item Text=”<img src=’images/image5.JPG’ alt=” height=’25px’ width=’22px’ /> Sub Module 5″ TargetUrl=”page5.aspx”>
<Labels Selected=”" />
</iglbar:Item>
</Items>
<Items>
<iglbar:Item Text=”<img src=’images/image6.JPG’ alt=” height=’25px’ width=’22px’ /> Sub Module 5″ TargetUrl=”page6.aspx”>
<Labels Selected=”" />
</iglbar:Item>
</Items>
</iglbar:Group>
</Groups>
<DefaultItemHoverStyle ForeColor=”Blue” Cursor=”Hand”>
</DefaultItemHoverStyle>
<DefaultItemSelectedStyle BorderStyle=”Solid” BorderWidth=”1px” Cursor=”Default”>
</DefaultItemSelectedStyle>
<DefaultItemStyle Cursor=”Default” Font-Names=”Verdana” Font-Size=”8pt” Height=”25px”>
<Margin Left=”1px” />
<BorderDetails ColorBottom=”Silver” ColorLeft=”Silver” ColorRight=”Silver” ColorTop=”Silver”
StyleBottom=”Solid” StyleLeft=”None” StyleRight=”None” StyleTop=”None” WidthBottom=”2px” />
</DefaultItemStyle>
<DefaultGroupStyle BackColor=”WhiteSmoke” Cursor=”Default”>
</DefaultGroupStyle>
<DefaultGroupHeaderAppearance>
<CollapsedAppearance ExpansionIndicatorImage=”downarrows_white.gif”>
<Images>
<ExpansionIndicatorImage Url=”downarrows_white.gif” />
</Images>
</CollapsedAppearance>
<HoverAppearance>
<Style BackgroundImage=”orangeExplorer.gif”></Style>
</HoverAppearance>
<ExpandedAppearance ExpansionIndicatorImage=”uparrows_white.gif”>
<Images>
<ExpansionIndicatorImage Url=”uparrows_white.gif” />
</Images>
<Style BackgroundImage=”blueExplorer.gif” Cursor=”Default” Font-Names=”Verdana”
Font-Size=”10pt” Height=”23px” Width=”100%”>
</Style>
</ExpandedAppearance>
</DefaultGroupHeaderAppearance>
</iglbar:UltraWebListbar>
some times we have to add items dynamically taking from database. for that code in vb.net is as follows
my data table is look like this.
|
Module |
SubModule |
Order |
link |
ImageUrl |
|
module1 |
submodule1 |
1 |
url1 |
image1.gif |
|
Module2 |
Submodule2 |
1 |
url2 |
Image2.gif |
|
Module3 |
Submodule3 |
2 |
url3 |
Image3.gif |
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim dtbNavigation As New DataTable
Dim da As New SqlDataAdapter(“Your Querry”, “your connection string”)
da.Fill(dtbNavigation)
If dtbNavigation.Rows.Count > 0 Then
Dim i As Integer = 0
‘Dim grs As New WebUI.UltraWebListbar.Groups(UltraWebListbar1)
Dim dtbModules As New DataTable
dtbModules = dtbNavigation.DefaultView.ToTable(True, “Module”)
For Each dr As DataRow In dtbModules.Rows
Dim j As Integer = 0
Dim gr As New WebUI.UltraWebListbar.Group()
gr.Text = dr.Item(“Module”)
gr.TextAlign = “left”
gr.Labels.Collapsed = “”
gr.Labels.Expanded = “”
gr.Labels.Selected = “”
Dim its As New WebUI.UltraWebListbar.Items(gr)
Dim drSubModules() As DataRow
drSubModules = dtbNavigation.Select(“ModuleName=’” & dr.Item(“Module”) & “‘”, “Order”, DataViewRowState.CurrentRows)
For Each dr1 As DataRow In drSubModules
Dim it As New WebUI.UltraWebListbar.Item
it.Text = “<img src=’images/” & dr1.Item(“ImageUrl”) & “‘ alt=” height=’22px’ width=’22px’ />” & dr1.Item(“subModule”)
it.TargetUrl = dr1.Item(“link”)
‘it.Image = “<img src=’~/images/” & dr1.Item(“ImageUrl”) & “‘ alt=” height=’22px’ width=’22px’ />”
it.Labels.Selected = “”
its.Insert(j, it)
gr.Items.Add(it)
j = j + 1
Next
UltraWebListbar1.Groups.Add(gr)
i = i + 1
Next
End If
End Sub