ASP.NET.in.a.Nutshell.Second.Edition [Electronic resources]

G. andrew Duthie; matthew Macdonald

نسخه متنی -صفحه : 873/ 551
نمايش فراداده

HtmlInputTextdisposable

System.Web.UI.HtmlControls (system.web.dll)class

This class represents the HTML <input type=text> or <input type=password> tag, which allow the user to enter a single line of text. If you use the password type, the user's input will be masked with the "*" character for display purposes.

Text entered in this control is provided in the Value property. You can specify the width of the textbox by using the Size property and the maximum number of allowed characters by using MaxLength. You can also react to the ServerChange event, which will fire only after a postback is triggered (for example, when the user clicks a submit button).

public class 

HtmlInputText : HtmlInputControl, System.Web.UI.IPostBackDataHandler { // Public Constructors public

HtmlInputText ( ); public

HtmlInputText (string

type ); // Public Instance Properties public int

MaxLength {set; get; } public int

Size {set; get; } public override string

Value {set; get; } // overrides HtmlInputControl // Protected Instance Methods protected override void

OnPreRender (EventArgs

e ); // overrides System.Web.UI.Control protected virtual void

OnServerChange (EventArgs

e ); protected override void

RenderAttributes (System.Web.UI.HtmlTextWriter

writer ); // overrides HtmlInputControl // Events public event EventHandler

ServerChange ; }

Hierarchy

System.Object System.Web.UI.Control(System.ComponentModel.IComponent, System.IDisposable, System.Web.UI.IParserAccessor, System.Web.UI.IDataBindingsAccessor) HtmlControl(System.Web.UI.IAttributeAccessor) HtmlInputControl HtmlInputText(System.Web.UI.IPostBackDataHandler)