This documentation is archived and is not being maintained.
HtmlTextWriter.RegisterTag Method
.NET Framework 1.1
Registers HTML tags, whether literals or dynamically generated, from the source file so that they can be properly rendered to the requesting client.
[Visual Basic] Protected Shared Sub RegisterTag( _ ByVal name As String, _ ByVal key As HtmlTextWriterTag _ ) [C#] protected static void RegisterTag( string name, HtmlTextWriterTag key ); [C++] protected: static void RegisterTag( String* name, HtmlTextWriterTag key ); [JScript] protected static function RegisterTag( name : String, key : HtmlTextWriterTag );
Parameters
- name
- A String that contains the HTML tag.
- key
- An HtmlTextWriterTag value that specifies which element is to be rendered.
Example
[Visual Basic] The following code example calls the RegisterTag method to associate a custom tag with a standard HTML element. When this HtmlTextWriter is used, creating an <f> element will cause a <FONT> element to be rendered.
[Visual Basic]
' When this version of the class's constructor is called,
' not only do you specify a tabString, but the code allows
' you to use shortcut elements for the font element,
' size attribute and width style attribute.
Public Sub New(writer As TextWriter, tabString As String)
MyBase.New(writer, tabString)
RegisterTag("f", HtmlTextWriterTag.Font)
RegisterAttribute("sz", HtmlTextWriterAttribute.Size)
RegisterStyle("w", HtmlTextWriterAttribute.Width)
End Sub 'New
[C#, C++, JScript] No example is available for C#, C++, or JScript. To view a Visual Basic example, click the Language Filter button
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: