Menu.IncludeStyleBlock Menu.IncludeStyleBlock Menu.IncludeStyleBlock Menu.IncludeStyleBlock Property

Definition

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.

public:
 property bool IncludeStyleBlock { bool get(); void set(bool value); };
[get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
[set: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
public bool IncludeStyleBlock { get; set; }
member this.IncludeStyleBlock : bool with get, set
Public Property IncludeStyleBlock As Boolean
Property Value

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.

Remarks

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.

Applies to