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

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

Sitemap and menu

Posted By:      Posted Date: October 26, 2010    Points: 0   Category :ASP.Net

Hi everyone!

I have question about using sitemap and i would appreciate everyone reply me. I am creating navigation menu using sitemap. i need to create the menu inline as 1)Home 2)Services  3)Contacts 4)FeedBack. but all elements are included into parent node so i have menu with one parent element displayed

Q1. How can i hide the parent elemet of  <sitemapnode> as it contains of all menu element that cause menu to be displayed one parent element with child elements.  Is it ok to use showstartnode="false" for SiteMapDataSource? if it is what should i specify for url elements of parent sitemapnode (it should be empty one as i guess)?

Q2. What do you think about using sitemap for navigation menu at all? Can it affect to site perfomance ? Maybe it is better to use css menu?

Q3. And what about dynamic menu based on <aspx:menu> and sitemap if user's browser has javascript action disabled? i guess dynamic menu will be failed in this case, won't be?

View Complete Post

More Related Resource Links

Menu - Role security not working on second level of sitemap


I have role assignments on both the first and second level of my menus within my sitemap file.  The first level works fine, and I only see items assigned to my role.

But roles assignments seem to have no effect on the second level.  It seems like if you have access to the first level, you have access to everything on the second level.

Is this correct?

From my sitemap (either a SalesRep or an Administrator can see everything underneath):

    <siteMapNode title="Administration" roles="SalesRep,Administrator" description="Admin" >

      <siteMapNode title="CompanyMaintenance" roles="SalesRep" url="~/Admin/CompanyManagement.aspx" />

      <siteMapNode title="Initialize Roles" roles="Administrator" url="~/Admin/Roles.aspx"/>


From my config:

    <roleManager enabled="true" defaultProvider="SqlRoleProvider">

Adjusting fontcolor on a sitemap menu


I've been working for hours on something that should be simple but baffles me.  Perhaps, someone could give me a suggestion.

I'm trying to change the font color of a sitemap to white.  The color is white in the developer screen but black in the browser when I run it.  In fact, it should change to white when I hover over it but it does not.

Here is my code perhaps someone could see what I'm doing wrong.


<td class="style3" bgcolor="#E3D8B6" width="200px" style="float: right; color: #FFFFFF;">

     <asp:Menu ID="Menu1" runat="server" DataSourceID="SiteMapDataSource1" StaticDisplayLevels="2" ForeColor="White" ItemWrap="True" BorderStyle="Solid" StaticSubMenuIndent="0px" BorderWidth="1px">

          <StaticSelectedStyle Font-Italic="True" BackColor="#1C5E55" />

          <DynamicSelectedStyle BackColor="#343055" ForeColor="White" />

          <StaticHoverStyle BackColor="#332F54" ForeColor="White" />


Strange web.sitemap asp:menu behavior


I have a menu that is populated from a web.sitemap.  It works most of the time but on some every once in a while the links will have "/(x(1))/" inserted into them.   The links still work but people are prompted to login for each page they go to.

If I compare my local copy of the web.sitemap with the live one they are identical.  Replacing the live sitemap with my local copy fixes the problem.  I can even copy the live one down to my local machine and then back up and it will fix the problem.  So something is being reset, I'm just not sure what it is.  Any thoughts on how to fix this?

This is the only search result that seems relevant but I'm still not sure how to go about fixing it.


menu and sitemap have errors.


Hi there I am a student in an ASP.NET class 2.0.

Anyways, I am getting squigly lines in my code and asp.net is telling me that the sitemap and my menu are not supported.
I am trying to make my code as clean as possible, the code works but is just not clean enough. Please tell me why there are squigly lines and what I can
Do to make the page more asp.net friendly.

Thanks Much!

JonnyBelow is my code I am useing in a master.master page.  Thanks in advance.


<form id="form1"

Css menu control with Sitemap, rollover and dynamic images


Hi all

I have been building a site (http://www.leisurepursuits.co.uk) but i am having some trouble.

I built it using a bunch of links with a css rollover style.

However, what i would like to do is a)have sub menu items and b) have it so that the button which relates to the page the user is on is always highlighted.

Now to me, the obvious choice would be to build a sitemap (which i have done) use the menu control (which i have done) apply images to each individual node (i dont know how to do this) create a rollover (i dont know how to do this) and then programatically make it so the button stays highlighted if they are on the relevant page (i dont know how to do this)

So is anyone able to point me in the irght direction for doing the last three at all?

I have been googling for ages and just cannot find a half decent tutorial on the menu control which covers the points i make above.

I would really apreciate your help

Thanks very much

ASP.NET Menu with jQuery Superfish

Choosing the right type of menu for a website is not easy at all. The ASP.NET Menu Control is definitely NOT a good starting point due to the horrendous markup it renders, nor is it good for SEO because of the Markup/Content ratio, neither can it be easily styled.

Problem making Role based Menu in MVC application



 I want to make Rolebase menu in MVC such that if user doesnot have permission for some action then that Action name shouldnot be shown in the Menu.

 I have used the code in the url(http://forums.asp.net/t/1566328.aspx) in my MVC application.My application is a Discussion Forum(in MVC) same functionality as in this forum forums.asp.net

 I have used Controllers for post, thread etc.In each controller there are some actions that are using [Authorize(Roles)] attribute

 but this coding does not count  those Actions in Controllers having Authorize attribute according to the url http://forums.asp.net/t/1566328.aspx 

 In the code, Authorize attribute is applied to Controller class, but my requirement is of Applying Authorize attribute to some actions in controller so that some are available for all users and  some links are available rolewise.Now what is the solution for that?



DropDownExtender - menu disapears


Hello all, first ever post here :)

Hope you guys can help me out, this drives me crazy...

So I got 2 updatepanels on my page. In one there is a Timer which updates for example a label. In the other one there is a dropdownextender. Everytime the timer ticks while the dropdown menu is displayed the menu disapears. I attached the sample code below....any insights on this? And yes, the dropdown and the label need to be in two seperate updatepanels....

Many thanks



<form id="form1" runat="server">

<asp:ToolkitScriptManager ID="ScriptManager1" runat="server" />

<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<asp:Timer ID="Timer1" runat="server" OnTick="Timer1_Tick" Interval="4000" />
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>

<asp:UpdatePanel ID="UpdatePanel2" runat="server">


Can't get an Icon to show for Desktop shortcut and Program Menu



I've created a SetupWizard, but can't get it to show the Icon for the shortcut on desktop and program menu. The installation goes fine without any errors, the only problem is the icon.

I've made a shortcut of my exe file in the Application Folder and dragged the shortcut to the Desktop folder, then on the shortcut properties, I assigned it an icon picture located in Application Folder.

Any suggestions will be very much appreciated.


Custom Control Design-Time SiteMap Provider Error


Greetings - I was referred here by MSDN forums hope this is the right place -  

I have a custom control (:WebControl) that renders web.sitemap in a specific way. While it runs error free and produces the expected result, at Design-Time it complains

Error Creating Control - MyControl  The provider 'AspNetXmlSiteMapProvider' specified for the defaultProvider does not exist in the providers collection.

I have discovered that the error is cause by this line of code:

string div = string.Format("<div class='{0}' id='{1}'>{2}</div>", this.CssClass, this.ID.ToString(), EnumerateNodesRecursive(SiteMap.RootNode, level));

or more specifically, by the reference to SiteMap.RootNode - I am not clear what is missing thoough because I have configured the SiteMapProvider in web.config as this:

        <add name="AspNetXmlSiteMapProvider" 
             type="System.Web.XmlSiteMapProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" 

May i use the collapse and expand feature (like tree menu) in Report ?


HI all,

May i use the collapse and expand feature (like tree menu) at Report iam using the Report viewer  Control for displaying the Report on my Asp.net Page .


I have number records and each record have detail as i clicked or expand the record then details will be shown is it possible with report viewer control 
If any one have experince before please share the ideas.


Best Regards

Changing classic asp.net Menu to CssAdapterMenu


Hello Friends,

                     I have been using asp.net menu control that is programmatically binded at runtime and has n child node levels. Now i want to use CssAdapterMenu instead because the menu control contains more than 1000 menuItems(in the near future it can also be more 2000 menuItems) and has very slow response in IE 6 or IE 7.

                    Now my question is how should i change the classic asp.net menu to CssAdapterMenu. What should be the steps? Any samples example of n child node levels would be helpful


Asp.net menu cssadapter


Hi All,

I am using asp.net menu using cssadapter. How Can I change this the menu show menu using mouse click




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

.AspNet-Menu-Selected Problems


I am trying to have the selected item in the menu be noticeable different than the other items.  I am able to change the border as in the samples, but nothing else. I would like the selected font color to change as well as the background image / color.  Here is a sample page and style sheet.  Any help is greatly appreciated.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
    <link href="MainStyle.css" rel="stylesheet" type="text/css" />
    <form id="form1" runat="server">
    <table border="0" cellpadding="0" cellspacing="0" style="width: 100%; height: 100%">
                    <!-- Indention Pushes First Link Over -->

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

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