HtmlTextWriter.RenderBeginTag Method (HtmlTextWriterTag)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Writes the opening tag of the markup element associated with the specified HtmlTextWriterTag enumeration value to the output stream.

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

abstract RenderBeginTag : 
        tagKey:HtmlTextWriterTag -> unit
override RenderBeginTag : 
        tagKey:HtmlTextWriterTag -> unit

Parameters

tagKey
Type: System.Web.UI.HtmlTextWriterTag

One of the HtmlTextWriterTag values that defines the opening tag of the markup element to render.

Use the RenderBeginTag overload of the RenderBeginTag(HtmlTextWriterTag) method if the markup element is of a known type that is one of the HtmlTextWriterTag enumeration values.

To generate a markup element by using the RenderBeginTag method, first call the AddAttribute and the AddStyleAttribute methods, as necessary, to specify any element attributes or style attributes that are to appear in the opening tag of the element. After generating the inner markup, call the RenderEndTag method to generate the closing tag.

The following code example shows how to use the RenderBeginTag method to output the opening tag of an <img> element. The attributes that are added to the element by the AddAttribute method will be in the opening <img> tag. The RenderEndTag method is used to generate the closing tag.

This code example generates the following markup:

<img alt="Encoding &quot;Required&quot;" myattribute="No &quot;encoding&quot; required">

</img>

No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1
Return to top
Show: