Click here to Skip to main content
15,920,513 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
Hi There,

I want to built dynamic menu Vertically where clicking on menu should open up child menu and hide all other menu like


when i click on Menu1 its child should open like

Like this way. Can any one help.

Thanks in Advances.
Updated 25-Mar-12 21:43pm
senguptaamlan 26-Mar-12 3:38am    
what U have done...and where U are facing the problem?
suhailnoorpawane 26-Mar-12 3:42am    
i havent done any thing want something to start from. if similar line of code i get i can make it work in mine.

Thanks for the reply
senguptaamlan 26-Mar-12 3:48am    
Please, do something after that if U face any technical issues...the any one can help you...but the technical approach should come from your side first...don't take me otherwise..its for Ur the guys are for helping not for performing anyone's homework or project work (I may be harsh but that's the fact)
suhailnoorpawane 26-Mar-12 3:57am    
thanks for the advice
suhailnoorpawane 26-Mar-12 4:05am    
i think you got me wrong there. I know how to create menu using database(dynamically) Only thing i wanted is that the fashion in which they are display as i shown in my example. Because all i got is menu and there child some out popping in hierarchical manner which i don't want(popping). it should come inside it

Do reply if you got solution to this

Thanks for the reply

5- Click on this tab and you will see a blank web page where you can drag any control from the toolbox (which is in the left side of this window)
Open Web.config file and write true in place of false, See
  <compilation debug="true">

6- Drag a Menu Control from the navigation control tab

7-Now go in solution explorer and right click on the website and choose Add new item, select XML file
now again choose Add new item, select site Map .
8- Now open XML file and type this code in this.

view source
  <?xml version="1.0" encoding="utf-8" ?>

    <setction title="Section 1" value="default.aspx">
   <subpage title ="Page 1" value="page1.aspx"/>
    <subpage title ="Page 2" value="page2.aspx"/>
    <subpage title ="Page 3" value="page3.aspx"/>

   <setction title="Section 2" value="default.aspx">
   <subpage title ="Page 1" value="page1.aspx"/>     <subpage title ="Page 2" value="page2.aspx"/>
   <subpage title ="Page 3" value="page3.aspx"/>


9- Now open your site Map file and type this code in it.

view source
  <?xml version="1.0" encoding="utf-8" ?>
  <siteMap xmlns="" >

    <siteMapNode url= "Default.aspx" title= "Section 1"  description="">
    <siteMapNode url="Page1.aspx" title="Page 1"  description="" />
    <siteMapNode url="Page2.aspx" title="Page 2"  description="" />
    <siteMapNode url="Page3.aspx" title="Page 3"  description="" />

- In Design mode select menu control and click on the arrow (seems when you move cursor on menu control)
Choose Data Source -> choose XML or Site Map Data Source

 - Now run your web site by Ctrl + F5
Share this answer
In menu1 click_method, set ChildMenu1,ChildMenu2,ChildMenu3 visibility, others nonvisibility. that should be done.
Share this answer
suhailnoorpawane 26-Mar-12 3:43am    
but how to create this vertical menu which on click of menu pushes it child between other menu

thanks for the reply
Pandvi 26-Mar-12 3:55am    
In the Form1.cs[design], you can add menuStrip, you will find vertical menu.
I believe you want something like accordion control available in ASP.NET AJAX Control toolkit.

Please, visit the following link for the same.[^]

If this solves your requirement please, mark it as answered.
Share this answer
i need dynamic menu in
any body help me
Share this answer
[no name] 26-Mar-13 8:55am    
This is not an answer to this over year old question. If you have your own question to ask, then post it separately.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900