.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Need a CSS Friendly Menu Adapter in with I can assign each first-level menu item a different CSS?

Posted By:      Posted Date: April 10, 2011    Points: 0   Category :Windows Application


According to my project requirments I have to create an ASP.Net menu with each menu item having a different background image.

For this I need a CSS Friendly Adapter, I have searched alot and found this one Horizontal Menu Adapter .

Now I have a question regarding the web.sitemap defined in an example that comes with this above adapter code-

<?xml version="1.0" encoding="utf-8" ?>
<siteMap >
  <siteMapNode url="Nothing.aspx" title="Nothing"  description="Nothing">
    <siteMapNode url="Home.aspx" title="Home"  description="Home"></siteMapNode>
  <siteMapNode url="Forum.aspx" title="Forum"  description="Forum" >
    <siteMapNode url="MyPost.aspx" title="My Posts" description="My Post"/>
    <siteMapNode url="AllPost.aspx" title="All Posts" description="All Posts"/>
    <siteMapNode url="NewPost.aspx" title="New Posts" description="New Posts"/>

View Complete Post

More Related Resource Links

ASP.NET 4.0 Menu Top Level selected item style


I want to apply a css class to the level 1 menu item (parent) when it or any or it's children are selected.

I've looked at MSDN documentation and any number of examples and walkthroughs but I haven't come up with a way of managing this. I was thinking something like this might work but the style is not being applied to the parent. To further complicate matters, if I try to apply a css style to StaticSelectedStyle it doesn't pick it up at all.

Menu Markup:

<StaticSelectedStyle  Font-Bold="True" ForeColor="#3333CC" />

Code Behind:

        protected void MenuItemClick_NavMenu(Object sender, MenuEventArgs e)


            MenuItem parentItem = e.Item.Parent;

            if (parentItem != null)


                parentItem.Selected = true;



How to assign shortcut keys for menu item of asp.net menu control

I am using asp.net menu control. In window application we assign shortcut key through '&' sign for accessing menu item but in asp.net this is not working and there is not any property for access key for menu items. please give me any suggestion.

How to assign shortcut keys for menu item of asp.net menu control



I am using asp.net menu control. In window application we assign shortcut key through '&' sign for accessing menu item but in asp.net this is not working and there is not any property like access key for menu items. please give me any suggestion.



Nitin Munjani

Modify Menu adapter to show selected


Hey, I need some help modifying the menu adapter code to give child <ul> elements a class value indicating that the parent is selected. It should render like this:


< ul class="AspNet-Menu">
	< li class="AspNet-Menu-WithChildren  AspNet-Menu-ChildSelected">
		< a href="/rockit/admin/Default.aspx" class="AspNet-Menu-Link  AspNet-Menu-ChildSelected">
		< span>Mypage< /span>< /a>
			< ul class="AspNet-Sub AspNet-Sub-Selected">
				< li class="AspNet-Menu-Leaf  AspNet-Menu-Selected">
					< a href="/rockit/admin/Default2.aspx" class="AspNet-Menu-Link  AspNet-Menu-Selected">
					< span>Test< /span>< /a>
				< /li>
				< li class="AspNet-Menu-Leaf">
					< a href="/rockit/Default3.aspx" class="AspN

How to keep the hover for Parent menu and set the selected menu item css for child menu item?



I'm using cssfriendly control adapter for menu. My asp.net menu control's datasource is a sitemap file I'm using which contains all the urls.

I have the following questions:

  1. Is there a way to keep the parent menu item hovered while hovering over the respective child menu items?
  2. Is there a way to keep the child menu item selected? I am able to set the css for the parent menu, however I was wondering if the same is possible with the child items.

Please help! Smile


Moneka Smile

Css Friendly Adapters - asp.net Horizontal Menu - IE6



Hopefully someone can help.

I have an asp.net menu with horizontal static top tier followed by 2 dynamic vertical lower tiers.

It renders fine in all other browsers etc. etc. - apart from IE6.

In IE6 the menu is not rendered horizontally and insttead the items are stacked vertically.

It is my understanding that when using horizontal orientation, the menu items are effectively floated next to each other. 

So I can get round this float problem in IE6 by specifying a width for the items i.e.:


*html .AdminMenu .AspNet-Menu-Horizontal ul.AspNet-Menu li
	width: 45px;
	text-align: left;
	margin: 0;
	padding: 0;

Problem is, I do not want to set the width for each item. If I do this then it means regardless of the length of the text the width will always be the same.

On other browsers I do not set a width but instead set left/right margin so that every item is evenly spaced.

How can I do this in IE6? Essentially each li should wrap the text and float nex

Remove action that appear in the menu which appears when we right click each individual item in libr

i need to remove or hide edit properties menu from  menu which appears when we right click each individual item in library 

Creating a new document in Document Library from custom menu item (in the ECB)

Hello! I created a custom menu item in the ECB for a document library. I'd like for this to create a new document from this menu item. Additionally, I'd like to create a workflow where the Title of the document from which the menu action originates is inserted into a custom textfield in the new document that is created. Is this possible using SharePoint Designer?

Menu Item Spacing

I'm trying to use the menu control for the first time in ASP.NET and everything is fine except for the fact that I can't seem to change the item spacing property. My menu is a horizontal menu where the menu items have come from a sitemap file. I've tried changing the menu item spacing in both the dynamic and state menu item properties but nothing seems to change it. I've also tried changing the item spacing via css but that doesn't work either. Any ideas why this might be?<asp:Menu ID="mnuNavigation" runat="server" DataSourceID="mnuNavigationDataSource" Font-Names="Corbel" Font-Size="16pt" Orientation="Horizontal"> <StaticMenuItemStyle ForeColor="White" /> </asp:Menu> <asp:SiteMapDataSource ID="mnuNavigationDataSource" runat="server" ShowStartingNode="False" />

ASP.NET menu control with CSS Friendly dll casuses slow rendring

I am using ASP.NET menu control  with CSS Friendly dll casuses slow rendring,Is there any way i can make little bit fast rendring?Thanks in advance

Passing value from Menu item to my sql

How do I pass the value from my menu item to my sql in the back code? Here's what I have so far. Thank you very much. <div> <asp:Menu id="Menu1" runat="server" BackColor="#CC0000" BorderColor="#CCCCCC" OnMenuItemClick="Menu1_MenuItemClick" BorderStyle="Solid" DynamicHorizontalOffset="2" Font-Bold="True" Font-Names="Tahoma" Font-Size="12pt" ForeColor="White" Height="50px" Orientation="Horizontal" StaticSubMenuIndent="10px" Width="100%"> <StaticMenuStyle BorderColor="White" BorderStyle="Solid" BorderWidth="1px" /> <StaticSelectedStyle BackColor="#FF9900" /> <StaticMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" BorderColor="White" BorderStyle="Solid" BorderWidth="3px" /> <DynamicHoverStyle BackColor="#284E98" ForeColor="White" /> <DynamicMenuStyle BackColor="#B5C7DE" /> <DynamicSelectedStyle BackColor="#507CD1" />

Menu selected item formatting problem in mozilla

Hello, I have a problem with menu slected item. when i click on menu item it shold display in different color for that i hv wrote below code in my master page cs file. on page load.  string thispage = this.Page.AppRelativeVirtualPath; int slashpos = thispage.LastIndexOf('/');string pagename = thispage.Substring(slashpos + 1); string pagename = thispage.Substring(slashpos + 1); foreach (MenuItem mi in Menu7.Items) { if (mi.NavigateUrl.Contains(pagename)) mi.Selected = true; break; } this works fine in IE but when i run in firefox my page formatting disturbs means the content page not coming in a proper place. thanx in advance. do the needfull.         

Menu item and ViewModel pattern

Dear all, I need to build a ViewModel class for a Menu. For that menu I will have to provide information based on MenuItems collection and also handling the click event. Any advide on how to define my vieModel for that menu ? Thnaks for help regards SergeYour knowledge is enhanced by that of others.

In CssFriendly adapter Scrollbar is needed in Vertical Menu

Hi all,I have used cssfriendly adapter for creating vertical menu.... as i have more number of submenus and more number of listitems.... i need scrollbar.. in menu as it goes down the browser window..or menu should move up as it hit browser window....I tried "IFRAME" scrollable yes...and many different approach but could not get it....plz anybody can help it out.........

Cannot access Workflow from List Item menu: "Value does not fall within the expected range."


We are using Sharepoint 2007 sp2.

I am using Sharepoint Designer 2007 to create workflow for some List, suddenly I cannot acess some list items' workflow,and was informed  "Value does not fall within the expected range." , but other items are all ok.

I don't know whether this is concerned with the service pack 2, I installed sp2 yesterday.

Dynamic menu item in MenuItemTemplate (in SPGridView)




I am implementing a SPGridView in a webpart and would like to have dynamic row menus (with different menu items) based on some cell values. It seems that the answer is in the very-poorly documented property HiddenScript of a MenuItemTemplate object, which contains a custom javascript function which should return true if the menu item should be hidden, or false otherwise.


My question is - how do I pass arguments to this custom javascript function? This is how the sample code looks like:


SPMenuField colMenu = new SPMenuField();

colMenu.HeaderText = "Address";

colMenu.TextFields = "url";

colMenu.MenuTemplateId = "PresenterListMenu";

colMenu.NavigateUrlFields = "url";

colMenu.NavigateUrlFormat = "{0}";

How to remove 'Delete Item' from context menu of a programmatically created list?

How to remove 'Delete Item' from context menu of a programmatically created list?
I have document library which is created programmatically but now I don't want to have 'Delete Item' in context menu of that document library. Are there any possibilites?
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend