Jan 20, 2010, 6:38 AM
ext.Accordion in code behind
Hi,
i made a webusercontrol that builds a user related Accordion menu from a database, it works fine but I can't figure out how I could open the first panel by default after building.
A second thing I can't figure out is how I can convert the String value of my oMenuItem.icon to show the correct Icon
Something like mPanel.Icon = HOW DO I DO CAST THIS( oMenuItem.Icon )
My code :
Filip
i made a webusercontrol that builds a user related Accordion menu from a database, it works fine but I can't figure out how I could open the first panel by default after building.
A second thing I can't figure out is how I can convert the String value of my oMenuItem.icon to show the correct Icon
Something like mPanel.Icon = HOW DO I DO CAST THIS( oMenuItem.Icon )
My code :
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim oMenuStructuur As New List(Of Menu)
oMenuStructuur = MenuDA.GetMenuVoorUser(Context.User.Identity.Name)
' Build menu from table
Dim mAccor = New ext.Accordion
mAccor.ID = "Accordion"
Me.Controls.Add(mAccor)
For Each oMenuItem As Menu In oMenuStructuur
If oMenuItem.Depth = 0 Then
mPanel = New ext.MenuPanel
mPanel.Title = oMenuItem.Naam
mPanel.ID = "MenuPanel" & oMenuItem.Sort
'mPanel.Icon = HOW DO I DO CAST THIS oMenuItem.Icon
mPanel.Border = False
mPanel.Collapse()
mAccor.Items.Add(mPanel)
ElseIf oMenuItem.Depth = 1 Then
Dim mitem = New ext.MenuItem
mitem.ID = "Menuitem" & oMenuItem.Sort
mitem.Text = oMenuItem.Naam
mitem.Icon = ext.Icon.BulletRight
mitem.Listeners.Click.Handler = "#{CenterPanel}.load({url:'" & oMenuItem.Href & "', mode:'iframe', showMask:true, maskMsg:'Page " & oMenuItem.Name & " is loading...'});"
mPanel.Menu.Items.Add(mitem)
End If
Next
End Sub
Thanks on advanceFilip