Microsoft Knowledge Base Email Alertz

The CssClass property does not affect the MenuLabelHoverStyle property, the MenuPopupStyle property, the MenuVerbHoverStyle property, the MenuVerbStyle property, and the MenuCheckImageStyle property in ASP.NET 2.0

Search KbAlertz

Advanced Search

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]











Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks

Article ID: 911717 - Last Review: March 2, 2006 - Revision: 1.3

The CssClass property does not affect the MenuLabelHoverStyle, MenuPopupStyle, MenuVerbHoverStyle, MenuVerbStyle, and MenuCheckImageStyle properties in ASP.NET 2.0

On This Page

SYMPTOMS

Consider the following scenario:
  • In Microsoft ASP.NET 2.0, you try to use a style object of the System.Web.UI.WebControls.WebParts.WebPartZoneBase class.
  • You try to assign the style object by using the CssClass property.
  • You try to use the style object in the WebPartZone server control.
In this scenario, the style does not change as expected. Specifically, the CssClass property does not affect the following style objects:
  • The MenuLabelHoverStyle property
  • The MenuPopupStyle property
  • The MenuVerbHoverStyle property
  • The MenuVerbStyle property
  • The MenuCheckImageStyle property

WORKAROUND

To work around this problem, use inline style attributes for these style objects instead of using the external CssClass property. For example, do not use the following line of code.
<MenuPopupStyle CssClass="wp_menupopup" />
Note In this example, wp_menupopup is the class name of a style rule that defines the background color for elements.

Instead, use the following line of code.
<MenuPopupStyle backcolor="red" />

MORE INFORMATION

Steps to reproduce the problem

  1. In Microsoft Visual Studio 2005, click File, and then click New Web Site.
  2. In the Templates list, click ASP.NET Web Site.
  3. In the Location box, type DriveLetter:\Path\KB911717, and then click OK.

    Note DriveLetter:\Path\KB911717 is a placeholder for the location in which the blank ASP.NET Web site is created.
  4. In Solution Explorer, right-click Default.aspx, and then click Open.
  5. In the code designer, replace the existing code with the following code.
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head id="Head1" runat="server">
        <title>Test Page for KB911717</title>
        <link href="StyleSheet.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <asp:WebPartManager ID="WebPartManager1" runat="server">
            </asp:WebPartManager>
            <asp:WebPartZone ID="WebPartZone1" runat="server">
                <MenuPopupStyle CssClass="wp_menupopup" />
                <ZoneTemplate>
                <asp:calendar id="cal1" runat="server" />                            
                </ZoneTemplate>
            </asp:WebPartZone>
        </div>
        </form>
    </body>
    </html>
    
  6. On the Website menu, click Add New Item.
  7. In the Templates list, click Style Sheet, type Stylesheet.css, and then click Add.
  8. In the code designer, replace the contents of the Stylesheet.css file with the following code.
    .wp_menupopup
    {
    	background-color:Red   
    }
    
  9. On the Debug menu, click Start Debugging.

    Note If you are prompted to add a Web.config file that has debugging enabled, click OK.
  10. When the Default.aspx page opens, click the arrow on the upper-right corner of the Web Part. The background color of the menu is not red as you specified in the Stylesheet.css file.

REFERENCES

For more information about the Microsoft .NET Framework class library WebPartZoneBase class, visit the following Microsoft Developer Network (MSDN) Web site:
http://msdn2.microsoft.com/library/system.web.ui.webcontrols.webparts.webpartzonebase.aspx (http://msdn2.microsoft.com/library/system.web.ui.webcontrols.webparts.webpartzonebase.aspx)
For more information about the .NET Framework class library WebPartZone class, visit the following MSDN Web site:
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.webparts.webpartzone.aspx (http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.webparts.webpartzone.aspx)

APPLIES TO
  • Microsoft ASP.NET 2.0
Keywords: 
kbtshoot kbbug KB911717
Retired KB ArticleRetired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate