TextBox.TagKey Property
.NET Framework 2.0
Gets the HTML tag for the text box control. This property is protected.
Namespace: System.Web.UI.WebControls
Assembly: System.Web (in system.web.dll)
Assembly: System.Web (in system.web.dll)
/** @property */ protected HtmlTextWriterTag get_TagKey ()
protected override function get TagKey () : HtmlTextWriterTag
Property Value
HtmlTextWriterTag.Textarea if the text box is multiline; otherwise, Input.The following code example demonstrates how to use the Tagkey property to create a custom text box.
<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.JSL.Controls" Assembly="Samples.AspNet.JSL" %> <%@ Page Language="VJ#" AutoEventWireup="True" %> <HTML> <HEAD> <title>Custom TextBox - TagKey - VJ# Example</title> </HEAD> <body> <form id="Form1" method="post" runat="server"> <h3>Custom TextBox - TagKey - VJ# Example</h3> <aspSample:CustomTextBoxTagKey id="TextBox1" runat="server" text="Hello World!"> </aspSample:CustomTextBoxTagKey> </form> </body> </HTML>
package Samples.AspNet.JSL.Controls;
public class CustomTextBoxTagKey
extends System.Web.UI.WebControls.TextBox
{
/** @property
*/
protected System.Web.UI.HtmlTextWriterTag get_TagKey()
{
// If the TextMode is MultiLine, return a Textarea tag,
// else return an Input tag.
if (this.get_TextMode().Equals(System.Web.UI.WebControls.
TextBoxMode.MultiLine)) {
return System.Web.UI.HtmlTextWriterTag.Textarea;
}
else {
return System.Web.UI.HtmlTextWriterTag.Input;
}
} //get_TagKey
} //CustomTextBoxTagKey
Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.
Community Additions
ADD
Show: