Click here to Skip to main content
13,092,310 members (60,160 online)
Rate this:
Please Sign up or sign in to vote.
See more:

I wants to develop dynamic Menu And Submenu in mysite.
Which is look like :[^]

Only Parent and related Child I want to Show.

So if Anybody knows then plz help me

Posted 18-Nov-12 19:43pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Create two Method one for Menu and another one for Sub-Menu both Method return string data. Menu data put in your menu control. like that see below...
string Menu(List<menuitems> menuItems)
    string strMenu="";
    foreach(MenuItems item in menuItems)
        //It's demo menu tag, replace using your menu tag
        strMenu+="<a href=""+item.Url+"">"item.Name
    return strMenu;
string SubMenu(List<submenuitems> subMenuItems)
    string strSubMenu="";
    foreach(SubMenuItems item in subMenuItems)
        //It's demo sub-menu tag, replace using your sub-menu tag
        strSubMenu+="<a href=""+item.Url+"">"item.Name
    return strSubMenu;
//Then in your page load event write below code...
protected void Page_Load(object sender, EventArgs e)
    //let divMenu your menu control or container.
    List<MenuItems> menuItems=new List<MenuItems>(); //Select menu list here...

Try this maybe it's work for you...

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.170813.1 | Last Updated 20 Nov 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100