Export (0) Print
Expand All
Expand Minimize

Menu.IncludeStyleBlock Property

Gets or sets a value that indicates whether ASP.NET should render a block of cascading style sheet (CSS) definitions for the styles that are used in the menu.

Namespace:  System.Web.UI.WebControls
Assembly:  System.Web (in System.Web.dll)

public bool IncludeStyleBlock { get; set; }
<asp:Menu IncludeStyleBlock="True|False" />

Property Value

Type: System.Boolean
A value that indicates whether ASP.NET should render a block of CSS definitions for the styles that are used in the menu. The default value is true.

The Menu control uses CSS styles to control its appearance in a browser. By default, it renders a style element that contains the CSS definitions for the CSS classes that it uses. You typically set this property to false in the following situations:

  • You want to provide your own CSS definitions in order to customize the appearance of the menu. You must then provide your own block of CSS definitions in the page, or include a link to an external CSS file that contains the definitions.

  • You want to keep the default appearance but prefer to keep the generated CSS definitions in a separate file. You must then provide the file and link to it.

In either of these situations, you can get a copy of the default CSS block that the Menu control generates by setting the property to true, running the page, and viewing the page in a browser. You can then view the page source in the browser and copy and paste the CSS block into the page markup or into a separate file.

If you set this property to false, you cannot set style properties. For example, you cannot add a DynamicHoverStyle-ForeColor attribute in markup or set the DynamicHoverStyle.ForeColor property in code.

.NET Framework

Supported in: 4.6, 4.5, 4

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft