This documentation is archived and is not being maintained.

HtmlTextWriter.GetTagName Method

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

[Visual Basic]
Protected Overridable Function GetTagName( _
   ByVal tagKey As HtmlTextWriterTag _
) As String
[C#]
protected virtual string GetTagName(
 HtmlTextWriterTag tagKey
);
[C++]
protected: virtual String* GetTagName(
 HtmlTextWriterTag tagKey
);
[JScript]
protected function GetTagName(
   tagKey : HtmlTextWriterTag
) : String;

Parameters

tagKey
The HtmlTextWriterTag value to obtain the HTML element for.

Return Value

The HTML element.

Example

[Visual Basic] 
' The endTag variable must be declared as a string 
' in the class variable. Use the TagLeftChar,
' SlashChar, and TagRightChar fields and
' the GetTagName method to assign a value to
' the endTag variable.
endTag = TagLeftChar & SlashChar & GetTagName(HtmlTextWriterTag.Font) & TagRightChar
         
' Use the PushEndTag method to write the custom
' endTag string value as its parameter.
PushEndTag(endTag)
      End If 

[C#] 
// The endTag variable must be declared as a string
// in the class variable. Use the TagLeftChar,
// SlashChar, and TagRightChar fields and the 
// GetTagName method to assign a value to the
// endTag variable.
endTag = TagLeftChar + SlashChar + GetTagName(HtmlTextWriterTag.Font) + TagRightChar;

// Use the PushEndTag method to write the custom
// endTag string value as its parameter.
PushEndTag(endTag);

[C++] 
// The endTag variable must be declared as a String* in the class
// variable for this assignment to work. Use the
// TagLeftChar, SlashChar, and TagRightChar fields and the
// GetTagName method to assign a value to the endTag variable.
endTag = String::Concat( __box(TagLeftChar), __box(SlashChar), GetTagName(HtmlTextWriterTag::Font), __box(TagRightChar));

// Use the PushEndTag method to write the custom
// endTag String* value as its parameter.
PushEndTag(endTag);

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family

See Also

HtmlTextWriter Class | HtmlTextWriter Members | System.Web.UI Namespace

Show: