How to Build a Web Form for a One-Page Web Application - How to add a table to a form
(Page 3 of 4 )
Because you’re limited to what you can do with spaces and line breaks, you’ll frequently use tables to format a form in flow layout. 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. Note that when you make this type of change, Visual Studio creates style classes just like it does when you format text. Then, these classes are applied to the appropriate elements of the table.
You can also format a table in Design view by selecting one or more rows or columns and then using the commands in the Table 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

How to add a table to a form
Use the Table->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 Table menu or the shortcut menu to add, delete, resize, or merge the rows or columns.
Some of the formatting that you apply to tables, rows, and columns is saved in style classes. Then, you can apply the same formatting to other tables, rows, and 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
--------------------------------------------Figure 2-7 How to add a table to a form and text to a table
Next: How to add server controls to a form >>
More ASP.NET Articles
More By Murach Publishing
|
This article is an excerpt from chapter two of Murach's ASP.NET 3.5 Web Programming with VB 2008, written by Anne Boehm (Murach, 2008; ISBN: 1890774472). Check it out today at your favorite bookstore. Buy this book now.
|
|