Partilhar via


How to: Add and Configure a TextBox Control 

Use the TextBox control to obtain numeric, string, or password input from the user. A TextBox control set to display passwords hides a user's entry as it is typed, if the device supports that capability.

To add a TextBox control to an ASP.NET mobile Web page

  1. Drag a TextBox control from the Mobile Web Forms tab of the Toolbox onto a Form or Panel control, or inside a control's template on a mobile Web page. You can also drag it onto a mobile user control page.

  2. Optionally configure the TextBox control by doing the following:

    1. Enter the TextBox control's default text in its Text property.

    2. Set Password property to true to enable the user to enter the input as a password.

      NoteNote

      Setting a TextBox control to password mode does not encrypt or otherwise protect the password in transit from the browser to the server. To provide encryption, any page containing a password text box should use an SSL connection.

    3. Set the Numeric property to true to limit user input to numeric characters only. (Some markup languages, such as HTML, do not support this feature.)

    4. Set the MaxLength property to limit the number of characters that a user can enter. When the maximum number of characters is reached, the control stops accepting more characters. The default value of zero means that there is no limit to the length of the string.

    5. Set the Size property of the control to the number of characters that you anticipate for user input.

    6. Insert a line break after the TextBox control by setting the BreakAfter property to true.

    7. Customize the appearance of the TextBox control for specific devices with device filters and by overiding properties.

See Also

Reference

TextBox

Concepts

Introduction to the TextBox Control
Overriding Properties
Introduction to the Form Control
Introduction to the Panel Control

Other Resources

Using Device Filters