When setting the staticdisplaylevels = "2" w/ orientation="Horizontal" it places all menu items on one row, not 2 rows. Is it possible to use the Asp.Net Menu control to display the menu in 2 rows or do we need to use another solution?
Are you sure about this? This is supposed to work, so maybe the items only appear to be on the same row visually. Check the html source code, does it have two rows? The staticdisplaylevel property indicates how many levels are fully displayed, deeper menu
levels will show according to the selected menu item (and the dynamicdisplaylevel property).
Hope this helps !
Rinze Cats
---------
please select 'mark as answer' if this post helped you!
When you say 2 rows, are you looking for a menu like
this. If yes, then it can be implemented using pure CSS. The tutorials to do that is
here.
Lastly, if you want to use the CSS menu and at the same time render it in your asp.net application as a CSS menu, then you
might need to also use CSS Control Adapters. Scott Gu has an excellent post
here.
My intention was not to have to manage the clicked/ not clicked menu items and use the
StaticSelectedStyle-ForeColor and
StaticHoverStyle-BackColor properties of the Menu control. I have previously built this functionality with a repeater control but, was hoping for a solution which is easier to manage and with less coding with the standard Menu control.
Unless anyone can shed light on using the Menu control, I'll continue using the custom menu. Thanks..
A few years later but I post here a solution in case that somebody has the same problem.
You can achieve it with two menus and two sitemapdatasources. In the first menu you display only the first level and in the second menu only the second level, you can control the menu level in the sitemapdatasource by setting the statingnodeoffset property
to the desired level, here the code:
There is an event handler on the item bound event of the first menu, this is for selecting the right menu item when an item in the sub menu is selected, yes when you selected an item in the sub menu the main menu loses the selected item. To select the right menu item you have to get the current node from the sitemap and determine if the item is in the menu path. I written an extension method to do it:
trobin77
Member
125 Points
43 Posts
2 Level Static Horizontal Menu w/ Menu Control
Jan 02, 2008 02:59 PM|LINK
When setting the staticdisplaylevels = "2" w/ orientation="Horizontal" it places all menu items on one row, not 2 rows. Is it possible to use the Asp.Net Menu control to display the menu in 2 rows or do we need to use another solution?
asp:menu menu Menu Control ASP.NET 2.0 Menu
Rinze
Contributor
2580 Points
480 Posts
Re: 2 Level Static Horizontal Menu w/ Menu Control
Jan 02, 2008 03:41 PM|LINK
Are you sure about this? This is supposed to work, so maybe the items only appear to be on the same row visually. Check the html source code, does it have two rows? The staticdisplaylevel property indicates how many levels are fully displayed, deeper menu levels will show according to the selected menu item (and the dynamicdisplaylevel property).
Rinze Cats
---------
please select 'mark as answer' if this post helped you!
ihaathi
Member
166 Points
23 Posts
Re: 2 Level Static Horizontal Menu w/ Menu Control
Jan 02, 2008 05:24 PM|LINK
When you say 2 rows, are you looking for a menu like this. If yes, then it can be implemented using pure CSS. The tutorials to do that is here.
Lastly, if you want to use the CSS menu and at the same time render it in your asp.net application as a CSS menu, then you might need to also use CSS Control Adapters. Scott Gu has an excellent post here.
This post is given AS-IS. No Warranties.
trobin77
Member
125 Points
43 Posts
Re: 2 Level Static Horizontal Menu w/ Menu Control
Jan 02, 2008 06:10 PM|LINK
My intention was not to have to manage the clicked/ not clicked menu items and use the StaticSelectedStyle-ForeColor and StaticHoverStyle-BackColor properties of the Menu control. I have previously built this functionality with a repeater control but, was hoping for a solution which is easier to manage and with less coding with the standard Menu control. Unless anyone can shed light on using the Menu control, I'll continue using the custom menu. Thanks..
Amanda Wang ...
All-Star
30008 Points
3104 Posts
Re: 2 Level Static Horizontal Menu w/ Menu Control
Jan 04, 2008 04:49 AM|LINK
Hi,
Base on your description, do you want to make the Submenu item horizontal?
The ASP.NET 2.0 Menu Control doesn't support Horizontal fly-outs(please check the dannychen post in this thread: http://forums.asp.net/t/937518.aspx).
Maybe, you can try to consider to use the third party control instead, the third party control you can check this link: http://www.dotnetprogs.com/General/MenuExColl.aspx
Hope it helps.
Happy new year!
Microsoft Online Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
CasualTrash
Member
2 Points
3 Posts
Re: 2 Level Static Horizontal Menu w/ Menu Control
Nov 16, 2012 10:10 AM|LINK
A few years later but I post here a solution in case that somebody has the same problem.
You can achieve it with two menus and two sitemapdatasources. In the first menu you display only the first level and in the second menu only the second level, you can control the menu level in the sitemapdatasource by setting the statingnodeoffset property to the desired level, here the code:
There is an event handler on the item bound event of the first menu, this is for selecting the right menu item when an item in the sub menu is selected, yes when you selected an item in the sub menu the main menu loses the selected item. To select the right menu item you have to get the current node from the sitemap and determine if the item is in the menu path. I written an extension method to do it:
//Extension method public static bool IsInMenuPath(this SiteMapNode thisnode, SiteMapNode node) { var temp = node; while (temp != null && temp != thisnode) temp = temp.ParentNode; return temp != null; } //Event handler protected void Menu1_MenuItemDataBound(object sender, MenuEventArgs e) { e.Item.Selected = ((SiteMapNode)e.Item.DataItem).IsInMenuPath(SiteMap.CurrentNode); }asp:menu ASP.NET 2.0 Menu