Click here to Skip to main content
15,072,391 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

Menu1
Menu2
Menu3

when i click on Menu1 its child should open like
Menu1
ChildMenu1
ChildMenu2
ChildMenu3
Menu2
Menu3

Like this way. Can any one help.


Thanks in Advances.
Posted
Updated 25-Mar-12 21:43pm
v2
Comments
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 betterment...here 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
[no name] 1-May-12 4:54am
   
Reason for my vote of 1
faltu question
nika2008 26-Mar-13 6:42am
   
your menu i which programming languages c# or asp.net
and if c# WPF? or somthink else
can u tell me what u work

XML
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
print?
  <?xml version="1.0" encoding="utf-8" ?>
  <application>

    <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>

   <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"/>
    </setction>

  </application>

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

view source
print?
  <?xml version="1.0" encoding="utf-8" ?>
  <siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >

    <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="" />
    </siteMapNode>
  </siteMap>

- 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
 Ok

 - Now run your web site by Ctrl + F5
   
In menu1 click_method, set ChildMenu1,ChildMenu2,ChildMenu3 visibility, others nonvisibility. that should be done.
   
Comments
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.

http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/Accordion/Accordion.aspx[^]

If this solves your requirement please, mark it as answered.
   
i need dynamic menu in asp.net
any body help me
   
Comments
[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