Building a Web Form in ASP.NET - How to add a table to a form
(Page 3 of 5 )
Figure 2-7 shows how to add a table to a form. In this case, a table of six rows and two columns has already been added to the form, but the Insert Table dialog box is displayed to show what the settings are for that table. Usually, you can keep the dialog box entries that simple, because you can easily adjust the table once it’s on the form.
The easiest way to resize a row or column is to drag it by its border. To change the width of a column, drag it by its right border. To change the height of a row, drag it by its bottom border. You can also change the height and width of the entire table by selecting the table and then dragging it by its handles.
You can also format a table in Design view by selecting one or more rows or columns and then using the commands in the Layout menu or the shortcut menu that’s displayed when you right-click the selection. These commands let you add, delete, or resize rows or columns. They also let you merge the cells in a row or column. If, for example, you want a control in one row to span two columns, you can merge the cells in that row.
How to add text to the cells of a table
In figure 2-7, you can see that text has been entered into the cells in the first four rows of the first column of the table. To do that, you just type the text into the cells. Then, you can format the text by selecting it and using the controls in the Formatting toolbar or the commands in the Format menu. If, for example, you want to bold the four text entries, you can select the four cells that contain the text and click on the Bold button.
The Future Value form with a table that has been inserted into it

Figure 2-7. How to add a table to a form and text to a table
How to add a table to a form
- Use the Layout->Insert Table command to display the Insert Table dialog box. Then, set the number of rows and columns that you want in the table, set any other options that you want, and click OK.
How to format a table after it has been added to a form
- To resize a row, drag it by its bottom border. To resize a column, drag it by its right border. To resize the entire table, select the table and then drag its handles.
- Select rows or columns and then use the commands in the Layout menu or the shortcut menu to add, delete, resize, or merge the rows or columns.
How to add and format text
- To add text to a table, type the text into the cells of the table.
- To format the text in a table, select the text, and then use the controls in the Formatting toolbar or the commands in the Format menu to apply the formatting.
Description
- To control the alignment of the text and controls on a web form in flow layout, you can use tables.
Next: How to add server controls to a form >>
More ASP.NET Articles
More By Murach Publishing
|
This article is excerpted from the book Murach's ASP.NET 2.0 Web Programming with VB2005, written by Doug Lowe (Murach, 2006; ISBN: 1890774324). Check it out today at your favorite bookstore. Buy this book now.
|
|