Introduction to the TextBox Control
Applications use the TextBox control to enable users to enter a string. The TextBox control can mask input for passwords if the user's device supports it. A TextBox control must be placed within a Form or Panel control, or inside a control's template on a ASP.NET mobile Web page. You can also drag it onto a mobile user control.
A TextBox accepts user input, which is a potential security threat. By default, ASP.NET mobile Web pages validate that user input does not include script or HTML elements. For more information, see Script Exploits Overview.
Applications set an initial value for the TextBox control with the Text property. The Size property specifies the expected width of the input string in characters. The TextBox control scales its input box according to the value of the Size property. A value of 0 indicates that the TextBox control uses its initial size settings. The input string (and the initial string) can contain more characters than specified in Size. If the user enters a string that is too long for the input box, previous input characters scroll. You can set a maximum length for the input string using the MaxLength property.
To accept only numeric input, set the Numeric property to true. However, not all markup languages support this setting. For example, HTML does not.
Set the alignment of the control with the Alignment property. The alignment can be set to Left, Center, or Right. If no value is specified for the alignment, the TextBox control uses the default alignment. Customize the text appearance with the ForeColor, Font, and StyleReference properties. To insert a line break after the TextBox control, set the BreakAfter property to true.
Using a password text box does not encrypt the input data or protect it during transport from the browser to the server. Pages containing a password text box should be accessed only with a secure SSL connection to protect the data.
By applying device filters, applications can customize the TextBox control for particular devices. The device filters enable applications to selectively override the values of several of the TextBox control's properties, depending on the type of mobile device on which the control is displayed.