473,397 Members | 2,033 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Building Menu from DB

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
Nov 18 '05 #1
2 2187
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/Dow...ndex=0&tabid=1

There are articles on how to use this control on the Microsoft MSDN site.
http://msdn.microsoft.com/library/de...w/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::.." <an*******@discussions.microsoft.com> wrote in message
news:DC**********************************@microsof t.com...
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", "")
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 = True
Menu1.Opacity = 75
Menu1.zIndex = 100
End If
End Sub

Nov 18 '05 #2
You might be interested in this article
Data Walkthroughs for Web Forms Page
http://msdn.microsoft.com/library/de...ebFormsPage.as
An
ADO.NET for the ADO Programme
http://msdn.microsoft.com/netframewo...etprogmsdn.asp
Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: aleksander.helgaker | last post by:
I'm learning to program python on my Mac and I'd like some help. I followed a tutorial which showed how to make a calculator for working out the area of a shape. E.g. the area of a circal is...
1
by: Max | last post by:
We want to implement assigning permissions to web pages using a tree like view. The text below illustrates what the page would look like. Each of the items in the boxes are types of permissions...
4
by: Stephen Ritchie | last post by:
At the moment we have in Solution Explorer 12 projects and using the configuration manager we ahve all dependancies and build order set correctly. The problem is that when we do >Debug>Start (F5)...
16
by: sirsean | last post by:
Hi all. I'm trying to dynamically build menus and objects after my page loads. Data is stored in an XML file and is parsed at runtime into Javascript objects. At the moment, I'm working on creating...
1
by: Summa | last post by:
Hi, I have some functionality (a nice tree-menu) that I would like to deploy on some sites that are classic ASP. Can I somehow wrap this menu in C# (ASP.NET) and use it as an object in classic...
3
by: Eric Sabine | last post by:
This app will fill a datatable from sql server at load time (and can clear and reload it again if the user requests it). The contents of the data table contain program names and program groups. For...
3
by: Sameh Ahmed | last post by:
Hello there Need to create a context menu in runtime, everything is ok except that I need to check if a menuitem called "whatever" already exists in the context menu. Below is the code I use that...
2
by: moondaddy | last post by:
This is my first website using asp.net 2.0 and the first thing I noticed is no bin folder. After reading some other postings I saw mention that I needed to select Build Website from the build...
0
by: ssg31415926 | last post by:
I have a list view which contains various object types and I need to create a context menu with menu items dependent on the object type. I can detect the object type at MouseDown. I've written...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.