Solved

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

Posted on 2004-09-01
7
366 Views
Last Modified: 2012-05-05
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
0
Comment
Question by:viola123
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 8

Expert Comment

by:a_twixt_in_the_tale
ID: 11950407
0
 
LVL 5

Expert Comment

by:LindzK
ID: 11950455
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
 
LVL 5

Expert Comment

by:LindzK
ID: 11950476
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 9

Accepted Solution

by:
Lakio earned 200 total points
ID: 11965979
I recommend coolmenus by bratta! free and great
http://www.dhtmlcentral.com/projects/coolmenus/?m=10
0
 
LVL 6

Author Comment

by:viola123
ID: 11969089
hi, guys

thanks for your reply.

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

viola123
0
 
LVL 5

Expert Comment

by:LindzK
ID: 11970731
The code I posted will populate the example menu you mentioned - from your database tables.
0
 
LVL 9

Expert Comment

by:Lakio
ID: 11979601
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

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
how to use string functions to get particular string 3 51
Javascript: Range object 16 34
Conformation code 4 37
How does this modal gets closed? 6 42
This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question