HtmlTextWriter.RenderBeginTag Method (String)

Writes the opening tag of the specified markup element to the output stream.

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

public:
virtual void RenderBeginTag (
	String^ tagName
)
public void RenderBeginTag (
	String tagName
)
public function RenderBeginTag (
	tagName : String
)
Not applicable.

Parameters

tagName

A string containing the name of the markup element for which to render the opening tag.

Use the RenderBeginTag override of the RenderBeginTag(String) method, if the markup element is not 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 call the RenderBeginTag method in a custom control to render the opening tag of a non-standard MyTag element. The code example then calls the Write method to render inner markup, and then calls the RenderEndTag method to close the element.

This code example generates the following markup:

<MyTag>

Contents of MyTag

</MyTag>

// Create a non-standard tag.
writer->RenderBeginTag( "MyTag" );
writer->Write( "Contents of MyTag" );
writer->RenderEndTag();
writer->WriteLine();

// Create a non-standard tag.
writer.RenderBeginTag("Mytag");
writer.Write("Contents of MyTag");
writer.RenderEndTag();
writer.WriteLine();

Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

ADD
Show: