Search | Contact | Link To Us  

      ASP.NET      

ASP.NET
Dev Environment
Web Forms
Web Controls
ADO .NET
Web User Controls
Deployment
XML Web Services
ASP.NET Feedback Form
Resources
Discussions
VB .NET
About



Advertisement






































     HomeASP.NETWeb Controls> Table 

Table   

The Table Web server control allows us to build an HTML table and helps us organize data in a tabular form. Tables can be created at design time or run time. To create a table we also need the TableRow and TableCell web controls. If you create a table at design time you often fill it's contents with static data but if you create it at run time then you can fill it with dynamic content like binding it to a data source. The class hierarchy for this control is as follows:

Object
  Control
   WebControl
    Table

Notable Properties

Notable properties of the Table control are as follows:

CellPadding: Gets/Sets the distance between the border and the contents of the table cell
CellSpacing: Gets/Sets the distance between table cells
GridLines: Gets/Sets the gridline property of the table class
HorizontalAlign: Gets/Sets the horizontal alignment of the table within the page
Rows: Gets/Sets the collection of rows within the table

TableRow Control

The TableRow class is used to create the table rows we use in the Table control. It controls how the contents of the table are displayed. The class hierarchy for this control is as follows:

Object
  Control
   WebControl
    TableRow

Notable Properties

Notable properties of the TableRow class are as follows:

Cells: Gets a collection of the table cells for the table row
HorizontalAlign: Gets/Sets the horizontal alignment of the row contents
VerticalAlign: Gets/Sets the vertical alignment of the row contents

TableCell Control

The TableCell class represents a cell in the Table contol. We use the Text property to set the contents of the cell. The class hierarchy for this control is as follows:

Object
  Control
   WebControl
    TableCell

Notable Properties

Notable proeprties of the TableCell class are as follows:

ColumnSpan: Gets/Sets the number of columns the cell spans
HorizontalAlign: Gets/Sets the cell content's horizontal alignment
RowSpan: Gets/Sets the number of rows the cell spans
Text: Gets/Sets the text in the cell
VerticalAlign: Gets/Sets the cell content's vertical alignment
Wrap: Gets/Sets whether the cell content wraps

Creating Tables

Creating a table at design time is fairly simple. Drag a table control on to the form and add some rows and columns to it using the Rows property. When you click the ellipse button in the Rows property it opens the TableRow Collection Editor window as shown in the image below. You need to click the Add button found on this dialog to add rows to the table. Once you add a row to the table you can notice the properties for the newly added row in the right column of the TableRow Collection Editor window. You can set properties for the row in this column. To add a cell to a row, select the row and click the ellipse button found in the Cells property to open the TableCell Collection Editor Window. You need to click the Add button found on this window to add cells to the row. Once you add a cell to the row you can notice the properties of the newly added row in the right column of the TableCell Collection Editor window. You can add any number of cells to a row depending upon your requirements. You can view a table at work below.

Live Demo


Programming LanguagesDatabase
C#SQlServer
VB .NETDB2
JavaOracle
C++MYSQL
CFireBird


  Privacy Policy | Terms of Use | Site Map | Contact

  © 2004-2010 Startvbdotnet.com. All rights reserved.