Home > Articles > Programming > ASP .NET

  • Print
  • + Share This
From the author of

Adding a table to a web form is as easy as selecting the Insert Table button on the Designer Surface toolbar. This gives you an Insert Table dialog box to customize the table (see Figure 4).

Figure 4Figure 4 The Insert Table dialog box allows you to configure multiple properties of a table. This gives you a quick start in setting up a neatly formatted web form.

Within minutes you can build the rest of the web form. I made this a 2x2 table so I could create a space for a page header, menu bar on the left, and content at lower right. While you can add tables to the web form, you might be a little disappointed to learn how limited the table is in configurability on the Designer Surface. You can select the table and adjust table and cell height, but it isn't possible to alter the width of cells inside the table via the mouse. Modifying properties in the Object Inspector by selecting the cell lets you make some layout changes, but attributes such as valign are not available. Fortunately, you can work around these limitations by making changes to the HTML, which I'll discuss shortly.

Building a web form is quick and easy with the C#Builder Visual Designer tools. You can drag-and-drop controls from the Tool Palette and configure their properties easily via the Object Inspector.

Next, I populated the web form with text and controls by typing ASP.NET Demo in the header, selected the text, and then changed its style and centered it in the cell by using toolbar options for Text Style and Center Text, respectively.

To add a menu, I located the Web Controls section of the Tool Palette and dragged two LinkButton controls to the left column of the table. I selected each LinkButton control and changed its Text properties to About and Links in the Object Inspector. (Notice that the Object Inspector has two tabs at the top for changing properties and hooking up events.) All the controls on the page were dragged from the Tool Palette.

In the larger cell at lower right, I added a Label control with its Text property set to Please Enter Your Name:, a TextBox control, a Button control with its Text property set to Say Hello, and another Label control with its Text property blanked out.

  • + Share This
  • 🔖 Save To Your Account