Building Menu from DB

G

Guest

Hi can someone please tell me how I dynamically create a menu like the one shown below from a database. I want to create a loop that loops through all the records in a table and builds a table similar to the menu shown below

I would be grateful if you could give me a ny assistance with this

Thanks

...:: CODE ::.

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Loa
'Put user code to initialize the page her
If (Page.IsPostBack = False) The
Dim submenu1 As New skmMenu.MenuItem("<img src=""images/menublip.gif"" align=""absmiddle"">Home", ""

submenu1.SubItems.Add(New skmMenu.MenuItem("Sub Item 1", "page1.html")
submenu1.SubItems.Add(New skmMenu.MenuItem("Sub Item 2", "page2.html")

Dim submenu3 As New skmMenu.MenuItem("Sub Item 3 ->", ""
submenu3.SubItems.Add(New skmMenu.MenuItem("Sub Item 3 - 1", "page1.html")
submenu3.SubItems.Add(New skmMenu.MenuItem("Sub Item 3 - 2", "page2.html")

submenu1.SubItems.Add(submenu3
submenu1.SubItems.Add(New skmMenu.MenuItem("Sub Item 4", "page4.html")
submenu1.SubItems.Add(New skmMenu.MenuItem("Sub Item 5", "page5.html")
submenu1.SubItems.Add(New skmMenu.MenuItem("Sub Item 6", "page6.html")
Menu1.Items.Add(submenu1

Dim submenu2 As New skmMenu.MenuItem("<img src=""images/menublip.gif"" align=""absmiddle"">Office", ""

submenu2.SubItems.Add(New skmMenu.MenuItem("Sub Item 1", "page3.html", "tooltip1")
submenu2.SubItems.Add(New skmMenu.MenuItem("Sub Item 2", "page4.html", "tooltip2")
Menu1.Items.Add(submenu2

Menu1.CssClass = "menustyle
Menu1.DefaultCssClass = "menuitem
Menu1.DefaultMouseOverCssClass = "mouseover

Menu1.HighlightTopMenu = Tru
Menu1.Opacity = 7
Menu1.zIndex = 10
End I
End Sub
 
C

Cowboy \(Gregory A. Beamer\) [MVP]

The easiest way to produce a side menu from a database is to pull the
information from a database and bind to a DataGrid with a hyperlink column
(this can also be accomplished through a DataList or Repeater, with a bit
more work).

For a hierarchical menu, you can either use related DataTables in a DataSet
or pull the data as XML. You can download a free treeview control from
www.asp.net in the Internet Explorer Web Controls:
http://www.asp.net/IEWebControls/Download.aspx?tabindex=0&tabid=1

There are articles on how to use this control on the Microsoft MSDN site.
http://msdn.microsoft.com/library/default.asp?url=/workshop/webcontrols/overview/treeview.asp

These controls are not supported by Microsoft, but you will download the
full source, so you can work through any bugs yourself.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

************************************************
Think Outside the Box!
************************************************
Tim::.. said:
Hi can someone please tell me how I dynamically create a menu like the one
shown below from a database. I want to create a loop that loops through all
the records in a table and builds a table similar to the menu shown below!
I would be grateful if you could give me a ny assistance with this!

Thanks.

..:: CODE ::..

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
If (Page.IsPostBack = False) Then
Dim submenu1 As New skmMenu.MenuItem("<img
src=""images/menublip.gif"" align=""absmiddle"">Home", "")
submenu1.SubItems.Add(New skmMenu.MenuItem("Sub Item 1", "page1.html"))
submenu1.SubItems.Add(New skmMenu.MenuItem("Sub Item 2", "page2.html"))

Dim submenu3 As New skmMenu.MenuItem("Sub Item 3 ->", "")
submenu3.SubItems.Add(New skmMenu.MenuItem("Sub Item 3 - 1", "page1.html"))
submenu3.SubItems.Add(New skmMenu.MenuItem("Sub Item 3 - 2", "page2.html"))

submenu1.SubItems.Add(submenu3)
submenu1.SubItems.Add(New skmMenu.MenuItem("Sub Item 4", "page4.html"))
submenu1.SubItems.Add(New skmMenu.MenuItem("Sub Item 5", "page5.html"))
submenu1.SubItems.Add(New skmMenu.MenuItem("Sub Item 6", "page6.html"))
Menu1.Items.Add(submenu1)

Dim submenu2 As New skmMenu.MenuItem("<img
src=""images/menublip.gif"" align=""absmiddle"">Office", "")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Looping through Database?? 0
Help 0
ASP.NET Newbie Q 1
Database Menu Problems... Newbie 0
Database Menu Problem... Newbie 0
Error when I put code into server control! 1
Help with Function... 2
looping help? 5

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top