System.Web.UI.HtmlTextWriter.EnterStyle Method

Writes the opening tag of a markup 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, HtmlTextWriterTag tag)

Parameters

style
A System.Web.UI.WebControls.Style that specifies the layout and formatting to begin applying to the block of markup.
tag
An System.Web.UI.HtmlTextWriterTag that specifies the opening tag of the markup element that will contain the style object specified in style.

Remarks

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

The HtmlTextWriter.EnterStyle(System.Web.UI.WebControls.Style, HtmlTextWriterTag) 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, HtmlTextWriterTag) method that you use in the corresponding erload:System.Web.UI.HtmlTextWriter.ExitStyle method.

The erload:System.Web.UI.HtmlTextWriter.EnterStyle overload of the HtmlTextWriter.EnterStyle(System.Web.UI.WebControls.Style, HtmlTextWriterTag) method renders the opening tag of the element specified by the tag parameter. The HtmlTextWriter.EnterStyle(System.Web.UI.WebControls.Style, HtmlTextWriterTag) method then adds the necessary attributes and style attributes to the opening tag of the element to display the settings that are specified by the System.Web.UI.WebControls.Style object. Use the HtmlTextWriter.EnterStyle(System.Web.UI.WebControls.Style) overload to render the opening tag of a <span> element.

Requirements

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