Table Control in ASP.NET

This article shows the table control in ASP.NET.
  • 3068

This article shows the table control in ASP.NET.

Table control:

Table control are used to divide a page into several rows and columns to arrange the information, or The Table control is used in conjunction with the TableCell control and the TableRow control to create a table.

Properties: These are the following properties of the table control.

t3.gif
 

Figure 1.

Caption: The caption of the table.

CaptionAlign: The alignment of the caption text.

CellPadding: The space between the cell walls and contents.

CellSpacing: The space between cells.

GridLines: The gridline format in the table.

ForeColor: Color of the text within the control.

runat: Specifies that the control is a server control.  Must be set to "server" .

For example:

drag two table control from the toolbox.

<form id="form1" runat="server">

<asp:Table ID="Table1" runat="server" CellPadding="5"

GridLines="horizontal" HorizontalAlign="Center">

   <asp:TableRow>

   <asp:TableCell>1</asp:TableCell>

   <asp:TableCell>2</asp:TableCell>

   </asp:TableRow>

   <asp:TableRow>

   <asp:TableCell>3</asp:TableCell>

   <asp:TableCell>4</asp:TableCell>

   </asp:TableRow>

</asp:Table>

<br />

<asp:Table ID="Table2" runat="server" CellPadding="5"

GridLines="vertical" HorizontalAlign="Center">

   <asp:TableRow>

     <asp:TableCell>1</asp:TableCell>

     <asp:TableCell>2</asp:TableCell>

   </asp:TableRow>

   <asp:TableRow>

     <asp:TableCell>3</asp:TableCell>

     <asp:TableCell>4</asp:TableCell>

   </asp:TableRow>

</asp:Table>

</form>

 

</body>

</html>

 

Now save and run the application.

 

t4.gif
 

Figure 2.

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.