Dynamic database driven menu/submenu using ASP.NET

Hi everyone,

I have structure like this
(root) MenuItem1-> (level1) sub menu 1.1
(root) MenuItem2-> (level1) sub menu 2.1 -> (level2) sub menu 2.1.1
(root) MenuItem3-> (level1) sub menu 3.1 -> (level2) sub menu 3.1.2

The above means root level menu has three items and all of them has a child menu and sub menu 2.1 and 3.1 have another child menu level.

Can some one please help me the easiest / best way to implement this menu structure using ASP.NET and C#. I can use javascript if needed and Css is intended to be used for styling.

It will be great if I could be pointed to some examples. I can see there are many spghetti code javascript examples out there But i want to have a good control on items and hence want to build one from scratch .

Many thanks in advanced and looking forward to hear from experts out there.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


You may get a cool jQuery plugin which shows nested <UL> and <LI> in a cool way. Something like this: http://www.dynamicdrive.com/style/csslibrary/item/jquery_multi_level_css_menu_2/

Then build the <UL>'s and <LI>'s programmatically.

But the easiest way is to use the ASP.NET Menu which in the 'Navigation' tab in the toolbox.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
hussainAbidAuthor Commented:
Thanks for quick response but a question please if i make something in jquery and deploy solution on ASP.net enabled thirdparty webserver will it work out of the box or does something extra has to be installed on server.?

No man, jQuery is just a JavaScript file you include in the <head> tag of your page, it does not require anything installed on the hosting server.

Please let me help you in the code which builds the <UL>'s and <Li>'s dynamically from the database if you decided to use it. Also let me know if you want to build something which supports Rtl (Right To Left) layout (it seems you are Arabian).
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

hussainAbidAuthor Commented:
:). I m building a website to support Danish, swedish and Finish language. I will be checking your link tomorrow and then we will take it from there..  Thanks indeed.
hussainAbidAuthor Commented:
Excellent solution. Thanks
Johny BravoCommented:
Hi Experts,
I am in need of such dynamic menu,
Can you please tell me

>>Then build the <UL>'s and <LI>'s programmatically.

How?A small example will do a lot for me.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.