Creating Multilevel Menu at Runtime in ASP.NET? - asp.net

I have database Structure like below
TblMenu >>
MenuID, MenuName, LinkPath, MenuDesc, MenuPosition, IsParent, ChildID
I am fetching Items at Runtime at Masterpage and want to display items properly with my desired CSS Class but Only Top Level (all items). Now I want to Display Sub-Menu Items also as dropdown. Kindly suggest a way yo get that with ASP.NET and C#.
-John Bhatt

Related

Umbraco 7: create menu datatype with submenus

How can I create a navigation menu data type with submenu items so that I can create it in the back office with properties like text, href, optional image? Something like dropdown multiple.
I've installed Umbraco 7.1.5 with NuGet in VS2013 and using Razor syntax.
EDIT:
Is it possible to create an object of type menu and edit it in the back-end's UI, for a non-developer. The user should add as many items or sub items as needed with those properties, with a plus sign. I've found this property editor. Is this possible using this property editor?
Create a Partial View (in the back-end under the SETTINGS section). If you create a new partial view, one of the pre-created snippets will be "navigation".
Then use some CSS menu (you e.g. created yourself or found on google), and try to match the navigation HTML to that of the CSS menu.
To include the partial view in the template just use
#Html.Partial("NameOfThePartialWithoutExtention")

How to count only number of "Page" elements in Kentico

I'm building Bootstrap 3 menu webpart and I need to count the number of child elements. The code below does that, but unfortunately counts all elements (hidden, containers, etc...). I need to count only "Page" elements, or at least elements that I have unchecked from being listed in the main menu.
<%# IfCompare(Eval("NodeChildNodesCount"),0,"class='dropdown-toggle' data-toggle='dropdown' ","") %>
Is there any way I could improve the code above to filter out all that is not a "Page" menu item?
I would suggest that you use a nested repeater which would only load the Page menu item below the selected section in the menu.
You could then provide the list item in the item template to match your CSS.

Fluid Menu ASP.NET

We are developing a website with a drop down menu. The problem is the menu needs to be dynamic since the Parent and Child will be place under a single menu. This means that a single menu may contain multiple parents with multiple children. These parents/children are coming from a database.
http://imageshack.us/photo/my-images/405/h9o.png/
When hover the set of parent menu and children will be shown
http://imageshack.us/photo/my-images/836/fiz5.png/
The number of rows depends on the number of Parent and Children, The children will always under the parents, Children will not be broken into two different column. Which means the rows and columns are created dynamically based on the data that coming from the database. Any idea how to make this?
There are lots of menu solutions on the net.
I've used JQuery UI menu http://jqueryui.com/menu/ .
Just output your menu items as <li>'s and run the Jquery UI function .menu(); as they do in the example in the link page. The items in the menu can either be links to other pages or postbacks to the same page. If you postback you could in the item assign some value to a hidden field that you check in the code behind.

how to assign menu control to sub-node of sitemap on masterpage

i am using menu controls on my master-page and have used sitemap data-source to populate it. It shows main node on menu. is there a way that it populates the menu with sub-nodes of my master node rather than using default "home" ie masternode as starting menu item.
when you create a site map, you always design your properties in a way that it suites your web needs, They will contain, your starting node, name display, view state and autopostback.
Check your sipemapdatasource properties and your will know how to do that
You just simply put the ShowStartingNode = False in the SiteMapDataSource properties.
IT was simpler than i thoght.

ASP Menu bar, Static view

I am looking to create a menu bar with a specic type of "action"
Similar to the bar on this website
BBC Sport
Its totally static and has no dynamic or "pop out" sections. When the top menu is clicked the page will re-load and display the lower level in a diffrent colour.
Can this be achived with the Standard ASP:Menu control?
I am not a big fan of the pop out feature however I do not want all my options to be visible to my users at root
Hope that makes sense
Check out this basic ASP.Net Menu control page. You can click on the "Run" buttons to see very basic versions of the menus.
The advantage of using this particular approach is that you can tie it to a sitemap, so you don't have to keep updating the menu code. You just add the page(s) to the sitemap, and the menu picks it up.
You can also dynamically link the menu to different sitemaps, such as one for the admin menu and another for regular users' menu.
The Menu control is in the navigation section of the toolbox.
To experiment with the built-in functionality (before writing your own code to do what it will do for you), just drag and drop a menu control onto your form. Then, use the common tasks menu to:
autoformat -- good for quick & dirty because it sets hoverstyle too
set the data source
set the view type (static or dynamic)
define menu items with an editor
work with templates to set appearance
You have to go to properties to set menu appearance.

Resources