Support us .Net Basics C# SQL ASP.NET Aarvi MVC Slides C# Programs Subscribe Download

ASP.NET TextBox Control - Part 10

The TextBox control is used to get the input from the user of the web application. An asp.net textbox has several properties, that we need to be aware of as a developer. 



Properties of a TextBox control
1. TextMode Propertry - SingleLine, MultiLine and Password.
When you set the TextMode to MultiLine, use Rows property to control the number of lines to display for a MultiLine TextBox.

2. Text - Use this property to set or get the Text from the TextBox.

3. MaxLength - The maximum number of chatacters that a user can enter.

4. ReadOnly - Set this property to true if you don't want the user to change the text in the TextBox.

5. ToolTip - The tooltip is displayed when the mouse is over the control.

6. Columns - Use this property to specify the width of the TextBox in characters

7. Height - Set the height

8. Width - Set the width

9. AutoPostBack - By default, the TextChanged event of a TextBox control is cached in the viewstate, and is executed when the webform is submitted thru a postback by clicking the button control. If you want to change this behaviour, and post the webform immediately when the Text is changed, set AutoPostBack to true. Setting this property to true, will convert the cached event into a postback event.



Events of TextBox:
TextChanged - This event is fired, when the text is changed.

Methods of a TextBox:
Focus - Set input focus onto the control.

To view the properties of the TextBox, Right click on the control, and select Properties. In the properties window, you can also find the events supported by the control. 

All these properties can be set at the design time, or at runtime using code.

1 comment:

It would be great if you can help share these free resources