TableHeaderCell Constructor ()

 

Initializes a new instance of the TableHeaderCell class.

Namespace:   System.Web.UI.WebControls
Assembly:  System.Web (in System.Web.dll)

public TableHeaderCell()

Use this constructor to create and initialize a new instance of the TableHeaderCell class.

The following example demonstrates how to programmatically add a TableHeaderCell control to a Web page. For a complete, working code example, see the TableRow class overview topic.

// Create a header for the table.
TableHeaderCell header = new TableHeaderCell();
header.RowSpan = 1;
header.ColumnSpan = 3;
header.Text = "Table of (x,y) Values";
header.Font.Bold = true;
header.BackColor = Color.Gray;
header.HorizontalAlign = HorizontalAlign.Center;
header.VerticalAlign = VerticalAlign.Middle;

// Add the header to a new row.
TableRow headerRow = new TableRow();
headerRow.Cells.Add(header);

// Add the header row to the table.
Table1.Rows.AddAt(0, headerRow);  

.NET Framework
Available since 1.1
Return to top
Show: