Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I feel your pain and I wasted all night/morning trying to figure this out. With sheer brute force I figured out a solution. Call it a workaround - but it's simple.</p> <p>Add the CssClass property to your Menu Control's declaration like so:</p> <pre><code>&lt;asp:Menu ID="NavigationMenu" DataSourceID="NavigationSiteMapDataSource" CssClass="SomeMenuClass" StaticMenuStyle-CssClass="StaticMenuStyle" StaticMenuItemStyle-CssClass="StaticMenuItemStyle" Orientation="Horizontal" MaximumDynamicDisplayLevels="0" runat="server"&gt; &lt;/asp:Menu&gt; </code></pre> <p>Just rip out the StaticSelectedStyle-CssClass and StaticHoverStyle-CssClass attributes as they simply don't do jack.</p> <p>Now create the "SomeMenuClass", doesn't matter what you put in it. It should look something like this:</p> <pre><code>.SomeMenuClass { color:Green; } </code></pre> <p>Next add the following two CSS Classes:</p> <p>For "Hover" Styling add:</p> <pre><code>.SomeMenuClass a.static.highlighted { color:Red !important; } </code></pre> <p>For "Selected" Styling add:</p> <pre><code>.SomeMenuClass a.static.selected { color:Blue !important; } </code></pre> <p>There, that's it. You're done. Hope this saves some of you the frustration I went through. BTW: You mentioned:</p> <blockquote> <p>I seem to be the first one to ever report on what seems to be a bug.</p> </blockquote> <p>You also seemed to think it was a new .NET 4.0 bug. I found this: <a href="http://www.velocityreviews.com/forums/t649530-problem-with-staticselectedstyle-and-statichoverstyle.html" rel="noreferrer">http://www.velocityreviews.com/forums/t649530-problem-with-staticselectedstyle-and-statichoverstyle.html</a> posted back in 2008 regarding Asp.Net 2.0 . How are we the only 3 people on the planet complaining about this?</p> <p>How I found the workaround (study the HTML output):</p> <p>Here is the HTML output when I set StaticHoverStyle-BackColor="Red":</p> <pre><code>#NavigationMenu a.static.highlighted { background-color:Red; } </code></pre> <p>This is the HTML output when setting StaticSelectedStyle-BackColor="Blue":</p> <pre><code>#NavigationMenu a.static.selected { background-color:Blue; text-decoration:none; } </code></pre> <p>Therefore, the logical way to override this markup was to create classes for <em>SomeMenuClass a.static.highlighted</em> and <em>SomeMenuClass a.static.selected</em></p> <p>Special Notes:</p> <p>You MUST also use "<em>!important</em>" on ALL the settings in these classes because the HTML output uses "<em>#NavigationMenu</em>", and that means any styles Asp.Net decides to throw in there for you will have inheritance priority over any other styles for the Menu Control with the ID "<strong>NavigationMenu</strong>". One thing I struggled with was padding, till I figured out Asp.Net was using "<em>#NavigationMenu</em>" to set the left and right padding to 15em. I tacked on "<em>!important</em>" to my <em>SomeMenuClass</em> styles and it worked.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload