Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize

Menu.IncludeStyleBlock Property

.NET Framework 4.6 and 4.5

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; }

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
Show:
© 2015 Microsoft