The TextBox control Web Controls

262 where index is the zero-based ordinal position of the row whose TableRow object you wish to retrieve. Once youve retrieved a reference to an individual table row, you can use its Cells property to retrieve a reference to a TableCellCollection object, which contains a collection of TableCell objects representing the individual cells of the row. Like the TableRowCollection class, the TableCellCollection class has members to add and remove individual cells as well as to determine how many cells are in the collection. Its syntax for adding and removing cells is identical to that of the TableRowCollection class, except that TableCell objects are used instead of TableRow objects. Finally, to retrieve an individual cell, you use the TableCellCollection objects Item method, which has the following syntax: TableCellCollection.Itemindex where index is the zero-based ordinal position of the cell in the row. The property returns a TableCell object representing the cell. Finally, the TableCell class has a number of properties that control the content and appearance of the cell. The Text property determines the cells content. The Boolean Wrap property determines whether the contents of the cell wrap in the cell; its default value is True . The RowSpan and ColumnSpan properties are Integer values that indicate how many table rows and how many table columns the cell spans. The HorizontalAlign property, whose value is a member of the HorizontalAlign enumeration discussed earlier in this section, determines the horizontal alignment of the cells contents. The VerticalAlign property determines the vertical alignment of the cells contents. Its value must be a member of the VerticalAlign enumeration, which has the following members: Bottom , Middle , NotSet , and Top .

6.3.1.9 The TextBox control

The TextBox control corresponds to a single- or multi-line text box for displaying information and getting textual input from the user. It has the following HTML syntax: asp:TextBox id=TextBoxName AutoPostBack=True|False Columns=characters MaxLength=characters Rows=rows Text=text TextMode=Single|Multiline|Password Wrap=True|False OnTextChanged=OnTextChangedMethod runat=server The Text attribute defines the actual text to be stored in the text box when the control is rendered. The Columns attribute determines the number of characters that the text box displays, while the MaxLength attribute determines the total number of characters that can be input into the text box. The TextMode attribute determines whether the TextBox control has one line the default, multiple lines, or a single line into which the user is to enter a password. For a multi-line text box, the Rows attribute determines how many rows the text box displays, and the Wrap attribute determines whether text wraps onto the next line. By default, Wrap is False ; input will appear on a single line until the user enters a carriage return. Each of these attributes directly corresponds to an identically named property of the System.Web.UI.WebControls.TextBox class. The MaxLength, Columns, and Rows properties are all of type Integer and all have a default value of . In the case of the MaxLength property, this means that there is no limit to the number of characters that can be input to the text box. For the Columns and Rows properties, it means that as many columns or in the case of multi-line text boxes rows as possible will be displayed based on the size of the text box. The value of the TextMode property must 263 be a member of the TextBoxMode enumeration; possible values are TextBoxMode.SingleLine the default, TextBoxMode.MultiLine , and TextBoxMode.Password . The Text property, of course, is the most important property of the control. Its value includes any carriage return and linefeed characters the vbCrLf character entered by the user if the TextMode property is set to TextBoxMode.MultiLine . In addition, if the TextMode property is set to TextBoxMode.Password , asterisks are displayed whenever the user enters a character; however, the actual string input by the user is stored as is in the Text property. Finally, the OnTextChanged attribute defines an event handler that will be executed whenever the Text property of the text box is changed. The event handler designated by the OnTextChanged attribute must have the following signature: Sub OnTextChangedMethodsender As Object, e As EventArgs

6.3.1.10 Other web controls