System.Web.UI.WebControls Namespace TableCell Class
Sets or retrieves the horizontal alignment of content within a table cell.
Inline |
<asp:tablecell horizontalalign = enumValue ... > |
Script |
TableCell.HorizontalAlign [ = enumValue ] |
The property is read/write with a default value of NotSet.
Use the HorizontalAlign property to specify the horizontal position of the content in a TableCell class.
Setting this property affects only the individual cell. To apply the same alignment to the cells of an entire row in the table, set the HorizontalAlign property of the TableRow.
To apply the same horizontal alignment to all cells of an entire table, you can loop thru each cell in each row using the Cells and Rows collection.
The below snippet shows how to declaratively set the HorizontalAlign property of a table cell at design time.
<asp:table cellspacing=1 width = "92%" runat = "server">
<asp:tablerow>
<asp:tableheadercell>Table header</asp:tableheadercell>
</asp:tablerow>
<asp:tablerow>
<asp:tablecell horizontalalign = "center">Table data</asp:tablecell>
</asp:tablerow>
</asp:table>
The following example demonstrates how to programmatically set the horizontal alignment of the contents of each cell in a Table control.
Show me
TableCell Members VerticalAlign