HtmlTextWriter.GetTagKey Method

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

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

protected virtual HtmlTextWriterTag GetTagKey (
	string tagName
protected HtmlTextWriterTag GetTagKey (
	String tagName
protected function GetTagKey (
	tagName : String
) : HtmlTextWriterTag
Not applicable.



The markup element for which to obtain the HtmlTextWriterTag.

Return Value

The HtmlTextWriterTag enumeration value; otherwise, if tagName is not associated with a specific HtmlTextWriterTag value, Unknown.

If tagName is a null reference (Nothing in Visual Basic), an empty string (""), or cannot be found in the table of markup tag names, the GetTagKey method returns the Unknown field.

The following code example shows how to override the overload of the RenderBeginTag method that takes a string as its parameter. The string is passed to the GetTagKey method, which converts it to the corresponding HtmlTextWriterTag enumeration member, and then passes that to the RenderBeginTag overload that takes a HtmlTextWriterTag enumeration value as a parameter.

public override void RenderBeginTag(string tagName)
    // Call the overloaded RenderBeginTag(HtmlTextWriterTag)
    // method.

public void RenderBeginTag(String tagName)
    // Call the overloaded RenderBeginTag(HtmlTextWriterTag)
    // method.
} //RenderBeginTag

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