To use a text box, the web page visitor can click in it and start typing. You too can assign a value to a text box. Whenever the value of a text box has been changed, the control fires an event named TextChanged. In fact, this is the default event of the text box, which means if you double-click a text box while you are designing the form, the code of this event would be generated. The TextChanged event is of type EventArgs. You can use this event to take action while the text in the control is being changed.
To assist the user with specifying the value of a text box, you can make it remember some of the values that were previously used on it. To support this, the <asp:TextBox> tag is equipped with an attribute named AutoCompleteType. This attribute uses a value of the AutoCompleteType enumeration. The members of this enumeration are: None, Disabled, Cellular, Company, Department, DisplayName, Email, FirstName, Gender, HomeCity, HomeCountryRegion, HomeFax, HomePhone, HomeState, HomeStreetAddress, HomeZipCode, Homepage, JobTitle, LastName, MiddleName, Notes, Office, Pager, BusinessCity, BusinessCountryRegion, BusinessFax, BusinessPhone, BusinessState, BusinessStreetAddress, BusinessUrl, BusinessZipCode, and Search. To visually specify this characteristic, on the form, click the text box. In the Properties window, click AutoCompleteType and select from the list. To manually specify this aspect, add an AutoCompleteType attribute to the <asp:TextBox> tag and assign the desired member of the enumeration to it.
After using a text box, the user can click a button to send the value to you at the server. This characteristic is controlled by a Boolean attribute named AutoPostBack whose default value is "False". If you want the values to be automatically posted when the user clicks another control after using the text box, change the value of the AutoPostBack attribute from False to "True" to it. Here is an example: <%@ Page Language="C#" %> <html> <head> <title>Exercise</title> </head> <body> <form id="frmTimeSheet" runat="server"> <asp:TextBox ID="txtFullName" AutoPostBack="True" runat="server"></asp:TextBox> </form> </body> </html>
|
|
|||||||
|