System.Web.UI.HtmlTextWriter.EnterStyle Method

Writes the opening tag of a <span> element that contains attributes that implement the layout and character formatting of the specified style.

Syntax

public virtual void EnterStyle (System.Web.UI.WebControls.Style style)

Parameters

style
A System.Web.UI.WebControls.Style that specifies the layout and formatting to begin applying to the block of markup.

Remarks

Use the HtmlTextWriter.EnterStyle(System.Web.UI.WebControls.Style) method to apply styles, such as background color or border width, to a block of markup.

The HtmlTextWriter.EnterStyle(System.Web.UI.WebControls.Style) and erload:System.Web.UI.HtmlTextWriter.ExitStyle methods allow a device adapter or control to create markup that uses the character formatting of the specified style. Use the same value for style in the HtmlTextWriter.EnterStyle(System.Web.UI.WebControls.Style) method that you use in the corresponding erload:System.Web.UI.HtmlTextWriter.ExitStyle method.

The HtmlTextWriter.EnterStyle(System.Web.UI.WebControls.Style) overload of the HtmlTextWriter.EnterStyle(System.Web.UI.WebControls.Style) method renders the opening tag of a <span> element. This method then adds the necessary attributes and style attributes to the opening tag of the <span> element to display the settings specified by the System.Web.UI.WebControls.Style object. If you want to render a different markup element to contain the attributes and style attributes, use the HtmlTextWriter.EnterStyle(System.Web.UI.WebControls.Style, HtmlTextWriterTag) overload.

Requirements

Namespace: System.Web.UI
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 2.0.0.0