Table.HorizontalAlign Property

Definition

Gets or sets the horizontal alignment of the Table control on the page.

C#
[System.ComponentModel.Bindable(true)]
public virtual System.Web.UI.WebControls.HorizontalAlign HorizontalAlign { get; set; }
C#
public virtual System.Web.UI.WebControls.HorizontalAlign HorizontalAlign { get; set; }

Property Value

One of the HorizontalAlign enumeration values. The default value is NotSet.

Attributes

Examples

ASP.NET (C#)
<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head2" runat="server">
    <title>Table - C# Example</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>

    <h3>Table - C# Example</h3>

    <asp:Table id="Table1" runat="server" 
      GridLines="Both" BackImageUrl="image1.gif" 
      HorizontalAlign="Center" CellSpacing="3" 
      CellPadding="3">
      <asp:TableRow>
        <asp:TableCell>Row 0, Col 0</asp:TableCell>
        <asp:TableCell>Row 0, Col 1</asp:TableCell>
      </asp:TableRow>
      <asp:TableRow>
        <asp:TableCell>Row 1, Col 0</asp:TableCell>
        <asp:TableCell>Row 1, Col 1</asp:TableCell>
      </asp:TableRow>
    </asp:Table>
      
    </div>
    </form>
</body>
</html>

Remarks

Use the HorizontalAlign property to specify the horizontal alignment of the Table control within the page. The following table lists the different horizontal alignment styles.

HorizontalAlign value Description
NotSet The horizontal alignment of the Table control has not been set.
Left The Table control is left justified on the page.
Center The Table control is centered on the page.
Right The Table control is right justified on the page.
Justify The Table control is aligned with both the left and right margins of the page.

Applies to

Product Versions
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

See also