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

Top 5 Contributors of the Month
Post New Web Links

Style on asp.menu problem

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


I'm using the default CSS style (Style.css) that VS2010 creates for and ASP.NET web app and also more or less the default master page (Site.Master).

In Style.css there is a style definied for the active menu item:

div.menu ul li a:active
    background-color: #465c71;
    color: #cfdbe6;
    text-decoration: none;

and this is the code for my menu from Site.Master page:

<div class="clear hideSkiplink">
                <asp:Menu ID="NavigationMenu" runat="server" CssClass="menu" 
                    EnableViewState="false" IncludeStyleBlock="false" Orientation="Horizontal" 
                        <asp:MenuItem NavigateUrl="~/Default.aspx" Text="Domov"/>
                        <asp:MenuItem NavigateUrl="~/Stranka.aspx" Text="Stranke"/>
                        <asp:MenuItem NavigateUrl="~/Kontakt.aspx" Text="Kontakti"/>
                        <asp:MenuItem NavigateUrl="~/Polica.aspx" Text="Zavarovalne police"/>
                        <asp:MenuItem NavigateUrl="~/Password.aspx" Tex

View Complete Post

More Related Resource Links

Menu control style problem



I can not get the ItemSpacing to work. What is wrong ? -Hope you can help me.

            <asp:Menu ID="Menu1" runat="server" DataSourceID="smdsMaster" MaximumDynamicDisplayLevels="0"
                Orientation="Horizontal" StaticDisplayLevels="2" Width="100%" StaticMenuItemStyle-BorderStyle="Solid"
                StaticMenuItemStyle-BorderColor="Black" StaticMenuItemStyle-BorderWidth="1px">
                <StaticMenuItemStyle BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" Font-Bold="true"  
                HorizontalPadding="10px" ItemSpacing="10px" VerticalPadding="5px"  />
            <asp:SiteMapDataSource ID="smdsMaster" runat="server" />


            <asp:Menu ID="Menu1" runat="server" DataSourceID="smdsMaster" MaximumD

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?



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;



Menu doesn't popup when WIndow style set to AllowsTransparency="True" WindowStyle="None"

Hi,I'm facing an issue, when using Window style set to AllowsTransparency="True" WindowStyle="None", my menus in menubar doesn't popup, rather they gets hidden (not visible) and if you just click by guess then menu item will be executed, its just that menu item is not shown visisble.However, if I revert back the Window style to normal without Transparency then menus visible(popup) perfectly.I'm not sure what could be an issue?San

problem with menu Control

i am using menu Control and i got a interesting think when i run it through right click and click view in browser then sub menu under menu id display but when i will run it through debug mode then only root is display sub menu is not display.why? 

menu problem

Hiiiii Coders, I am just designing my menu. But still i want to geta menu like this- http://www.havells.com/  plz visit this link and same type of menu i want for my app also menu should cover my complete page means menu width should be equal to my webpage width which is 960px thanx and regards

Problem with Asp:menu control in IE8

Hai friends, Here i am facing a new problem,i created a navigation page by using asp:menu control,and after when i viewed it in Internet explorer8, the SubMenu's are not displaying. But when i checked the Compatibility view button which is next ot Stop and Refresh Or in Tools->CompatabilityView. then it is displaying the submenus. The same problem exists in Google Chrome but not in FireFox Can any one tell me the solution how to view the submenus without changing the Compatability settings. Thanks Maniraju

Menu Problem

Hiiii Coders, I m using css, html and jquery menu. My problem with this menu is that its width should be exact 960px. It should cover exact 960px of my browser window. Whenever i tried this by increasing margin, padding the menu item goes to next line. When i decrease it, it leaves a space and not match my banner just below the menu which looks very much odd. the html for my menu is-<td align="left" valign="top" width="960px"> <div id="colortab" class="ddcolortabs"> <ul> <li><a href="Home-main.aspx" title="Home"><span>Home</span></a></li> <li><a href="Company-Profile.aspx" title="About Us" rel="dropmenu1_a"><span>About Us</span></a></li> <li><a href="Products.aspx" title="Products" rel="dropmenu2_a"><span>Products</span></a></li> <li><a href="Group-Companies.aspx" title="Partners" rel="dropmenu3_a"><span>Group Companies</span></a></li> <li><a href="customers.aspx" title="Customers"><span>Clientele</span></a></li> <li><a href="Career.aspx" title="Careers"><span>Ca

Top navigation menu render problem

Hi, we have a problem with top menu used in a sharepoint site. There is a main site and one subsite wich inherits navigation from the parent. When we are viewing the main site top menu renders ok. When we are viewing child site, with some computers and browsers (not all) instead of the name of the parent site it apears the link. Name of the main site is 'Activity' Name of the subsite is 'Programs' Problem Accesing main site menu renders like ->    Activity  |   Programs Accesing child site menu renders like ->     sites/activity  |   Programs I have uploaded some image to clarify http://yfrog.com/jltopmenurendererrorp   At the master page the top menu is set in this way     <PublishingNavigation:PortalSiteMapDataSource ID="topSiteMap" runat="server" EnableViewState="false" SiteMapProvider="CombinedNavSiteMapProvider" StartFromCurrentNode="true" StartingNodeOffset="0" ShowStartingNode="true" TrimNonCurrentTypes="Heading" /> <SharePoint:AspMenu ID="TopNavigationMenuV42" Runat="server" EnableViewState="false" DataSourceID="topSiteMap" AccessKey="<%$Resources:wss,navigation_accesskey%>" UseSimpleRendering="true" U

WPF MenuItem CommandParameter specifie in style not available on menu first open

I am specifying a context menu within the ControlTemplate of a TreeViewItem as follows:                                       <ContextMenu ItemsSource="{Binding Commands}"> <ContextMenu.ItemContainerStyle> <Style TargetType="MenuItem"> <Setter Property="Command" Value="{Binding Command}" /> <Setter Property="CommandParameter" Value="{Binding CommandParameter}" /> <Setter Property="Header" Value="{Binding Name}" /> <Setter Property="Icon" Value="{Binding Icon}" /> </Style> </ContextMenu.ItemContainerStyle> </ContextMenu> where Commands is a list of ICommandViewModels objects with the following signature: public interface ICommandViewModel { string Name { get; } Image Icon { get; } ICommand Command { get; set; } object CommandParameter { get; set; } } When the ContextMenu is op

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 problem

hi alli made an asp.net menu and put it in aview or multiview i meanbut , the problem now that i want to when a menu item of that menu click , aview from that multiview appearshow can i do thatthanks

Printing Problem :- Style.Overflow property in Firefox


Hi All,

I have a web application which has two DIV, one is main and one is child. I am having  problem in printing multiple pages. There is a lot of data in the child DIV and i am using JavaScript functions to control the print functionality. When i print using window.print(), only the data on the main page currently being showed is printed. I further researched and checked out the Style.Overflow property.

Now i am using divMain.style.overflow = "visible"

After this the complete print comes. But in Firefox, the scroll bar disappears and only single page is left with no scroll bar

Now if after print i give divMain.style.overflow = "Auto" OR divMain.style.overflow = "Scroll", still the scroll bar doesn't come and if it comes then its inactive. I am unable to see the complete data on the page after the print is taken.

The problem is not coming in I.E and the full data with scroll bar is recovered in I.E.

Please help me how to get the normal page with full data and scroll bar after printing in Firefox. 




Printing Problem :- Style.Overflow property in Firefox


Hi All,

I have a web application which has two DIV, one is main and one is child. I am having  problem in printing multiple pages. There is a lot of data in the child DIV and i am using JavaScript functions to control the print functionality. When i print using window.print(), only the data on the main page currently being showed is printed. I further researched and checked out the Style.Overflow property.

Now i am using divMain.style.overflow = "visible"

After this the complete print comes. But in Firefox, the scroll bar disappears and only single page is left with no scroll

ASP Menu control problem


Hey I'm building a new site in VB.NET 4.0 and I just noticed that the ASP Menu component breaks W3C validation. Normally I'm not concerned with the whole deal but this project requires 100% validation and I'm building this from the ground up. I barely have anything in place but I have everything necessary. The second I add the ASP Menu and bind it the validator errors out with this:

Line 36, Column 214: there is no attribute "valign" 
.sg74gxVJW81&t=634083384129375000" alt="Expand Home" valign="middle" /></td>

It's a normal site using a master page. UTF-8 with XHTML 1.0 Transitional. I have a valid CSS and Sitemap. I would go back to treeview but the list is going to get ridiculously big and that's where I need this menu to replace it entirely. Strange part is that I never noticed this problem before. Is it an ongoing problem or did I find a new bug? I would like to see a fix for this if possible.

ASP.Net MEnu Problem



I have a page with an ASP.Net menu that also uses the CSS Friendly Adapter. WHen viewing the page on Localhost, it displays fine. When viewing the page on a remote webhost, it doesn't display properly. The Page source for both pages looks the same and the CSS file is viewable on the remote webhost. Here is what the menu looks like on localhost:

Here is what the menu looks like on remote webhost:

ANy ideas?



A Style Problem


hi i want  to put a button in my calendar style and when i click this button i will set the date of calendar. how can do that?


<Style x:Key="CalendarStyle" TargetType="{x:Type Calendar}">
        <Setter Property="Foreground" Value="{DynamicResource brCalendarForeColor}"/>
        <Setter Property="Background" Value="{DynamicResource brCalendarBackColor}"/>
        <Setter Property="BorderBrush" Value="{DynamicResource brBorderColor}"/>
          <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="Template">
                <ControlTemplate TargetType="{x:Type Calendar}">
                    <StackPanel x:Name="PART_Root" HorizontalAlignment="Center" Orientation="Horizon

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