!!!!--Urgent--!!!!database driven menu using javascript!!

i am working on an ASP.NET project, which involves with a javascript dynamic expandable menu(multi-level). all items of this menu should be based on a sql server database.

one example is as below:
http://developer.netscape.com/viewsource/smith_menu2/menu_vframes.html

but it's a static menu, rather than a dynamic database-driven menu. in addition, i need a multiple levels menu

thanks a lot

viola123
LVL 6
viola123Asked:
Who is Participating?
 
LakioConnect With a Mentor Commented:
I recommend coolmenus by bratta! free and great
http://www.dhtmlcentral.com/projects/coolmenus/?m=10
0
 
a_twixt_in_the_taleCommented:
0
 
LindzKCommented:
How are you getting your data from the database ?

Are you loading it into a dataset ?

If so, if it's in the code behind module, you could obtain the values you need from the dataset, and use response.write to populate your menu

So in your page load you could do something like
response.write("function loadMenus () {")
response.write("window.mySubMenu7 = new Menu('JavaScript');
    mySubMenu7.addMenuItem('JavaScript 1.0', 'top.window.location='http://developer.netscape.com');")
etc etc

But you'd fill in the text with the variable containing your database data instead
dim mymenuitem as string = Dataset1.tables(0).rows(0).item("itemname")
response.write("window.mySubMenu7 = new Menu('"& mymenuitem  &"');


Then rather than call loadmenus from the page, as it does in your example javascript file - you would call it using response.write - straight after you finish writing the the menu function
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
LindzKCommented:
So the main function would look something like

response.write("function loadMenus () {")
Dim row as datarow
for each row in mydataset.tables(0).rows
  response.write("window.mySubMenu7 = new Menu('" & row.item(0) &"');"))
next
response.write("}")
response.write(loadMenus();)
0
 
viola123Author Commented:
hi, guys

thanks for your reply.

but i need a database driven menu. that's why i post this thread here

viola123
0
 
LindzKCommented:
The code I posted will populate the example menu you mentioned - from your database tables.
0
 
LakioCommented:
Coolmenus can be database driven
http://www.dhtmlcentral.com/forums/topic.asp?TOPIC_ID=20471&SearchTerms=database

If you use the forum it will be easy to make it.
0
All Courses

From novice to tech pro — start learning today.