HtmlTextWriter.GetTagName(HtmlTextWriterTag) Method

Definition

Obtains the markup element associated with the specified HtmlTextWriterTag enumeration value.

C#
protected virtual string GetTagName(System.Web.UI.HtmlTextWriterTag tagKey);

Parameters

tagKey
HtmlTextWriterTag

The HtmlTextWriterTag to obtain the markup element for.

Returns

A string representing the markup element.

Examples

The following code example demonstrates how to close a <font> element by using the WriteEndTag method. The WriteEndTag method calls the GetTagName method to convert the Font value to a string.

C#
// Close the Font element.
Write(GetTagName(HtmlTextWriterTag.Font));

Remarks

If tagKey is not a valid HtmlTextWriterTag value, the GetTagName method returns an empty string ("").

Applies to

Product Versions
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

See also