Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


dynamic menu in c#

Posted on 2016-11-18
Medium Priority
Last Modified: 2016-11-21
i am trying to build  dynamic menu in as example in below URL

only one menu option is showing dropdown menu and not other menu options.

I need help on above url code to make other menu option with dropdown .

Thanks in advance.
Question by:rnsr
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
  • 6
  • 5
LVL 30

Expert Comment

by:Pawan Kumar
ID: 41892741
thats because the entries in the DB are missing. Add below entries in your table.


Open in new window

Hope it helps !

Author Comment

ID: 41892747
table entries are as example below  -

id       parentid    name     desc         url

1         0                a              aa         '~/Pawan.aspx'
2         0                b               bb         '~/Pawan1.aspx'
3         1                c                cc          '~/Pawan2.aspx'
4         1                d                dd         '~/Pawan3.aspx'
5         2                e                ee          '~/Pawa5.aspx'
LVL 30

Expert Comment

by:Pawan Kumar
ID: 41892749
So for these entries , what you are not getting ?
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.


Author Comment

ID: 41892754
a and b are main menu options.

 on click ' a' option i want to get drop down menu with option 'c' and 'd'
on click 'b' option i want to get drop down menu with option 'e'
LVL 30

Accepted Solution

Pawan Kumar earned 2000 total points
ID: 41892799
Change this in main.master...

<script type="text/javascript">
        //Disable the default MouseOver functionality of ASP.Net Menu control.
        Sys.WebForms.Menu._elementObjectMapper.getMappedObject = function () {
            return false;
        $(function () {
            //Remove the style attributes.
            $(".navbar-nav li, .navbar-nav a, .navbar-nav ul").removeAttr('style');

            //Apply the Bootstrap class to the SubMenu.

            //Apply the Bootstrap properties to the SubMenu.
            //$(".dropdown-toggle:has(ul)").find("a").eq(0).attr("data-toggle", "dropdown").attr("aria-haspopup", "true").attr("aria-expanded", "false").append("<span class='caret'></span>");
            $(".dropdown-toggle").each(function (index) {
                if ($(this).children('ul').length > 0) {
                    $(this).find("a").eq(0).attr("data-toggle", "dropdown").attr("aria-haspopup", "true").attr("aria-expanded", "false").append("<span class='caret'></span>");
            //Apply the Bootstrap "active" class to the selected Menu item.

Open in new window


Hope it helps !

Author Comment

ID: 41895373
   i placed this code but on wrong position in my code.


Author Comment

ID: 41895438
unable to show drop down menu when page  is loaded. it shows dropdown menu when one of the main menu option is clicked.

Any solution.
LVL 30

Expert Comment

by:Pawan Kumar
ID: 41895448
Can you please provide the screen shot?

Author Comment

ID: 41895475
attached image.

first time when page is loaded it shows drop down button but when clicked on it  no dropdown menu is shown. when i click on
add sub category then it will show all options of  drop down menu.

Plaese help.
LVL 30

Expert Comment

by:Pawan Kumar
ID: 41895483
I think that is the correct process. When you click on the menu item it should show sub menu items.

Author Comment

ID: 41895494
It doesn't show drop down when first time clicked on it after page is loaded. if i click on other option and then click on drop down menu , then it shows drop down options.

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

721 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