Bearbeiten

Freigeben über


HtmlTextWriter.GetTagName(HtmlTextWriterTag) Method

Definition

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

protected:
 virtual System::String ^ GetTagName(System::Web::UI::HtmlTextWriterTag tagKey);
protected virtual string GetTagName (System.Web.UI.HtmlTextWriterTag tagKey);
abstract member GetTagName : System.Web.UI.HtmlTextWriterTag -> string
override this.GetTagName : System.Web.UI.HtmlTextWriterTag -> string
Protected Overridable Function GetTagName (tagKey As HtmlTextWriterTag) As String

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.

// Close the Font element.
WriteEndTag( GetTagName( HtmlTextWriterTag::Font ) );
// Close the Font element.
Write(GetTagName(HtmlTextWriterTag.Font));
    ' Close the Font element.
    Me.WriteEndTag(GetTagName(HtmlTextWriterTag.Font))
End If

Remarks

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

Applies to

See also