TableCaptionAlign TableCaptionAlign TableCaptionAlign TableCaptionAlign Enum

Definition

Specifies the horizontal or vertical placement of the text to render as the HTML caption element.

public enum class TableCaptionAlign
public enum TableCaptionAlign
type TableCaptionAlign = 
Public Enum TableCaptionAlign
Inheritance
TableCaptionAlignTableCaptionAlignTableCaptionAlignTableCaptionAlign

Fields

Bottom Bottom Bottom Bottom 2

The caption element is aligned with the bottom of the table.

Left Left Left Left 3

The caption element is aligned with the left side of the table.

NotSet NotSet NotSet NotSet 0

The caption alignment is not set. The browser that renders the caption determines where to align the caption.

Right Right Right Right 4

The caption element is aligned with the right side of the table.

Top Top Top Top 1

The caption element is aligned with the top of the table.

Examples

The following example demonstrates how to use the TableCaptionAlign enumeration to set the CaptionAlign property in a Table control. The Table control contains TableRow objects that display City and ZIP Code values.

<%@ 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="Head1" runat="server">
    <title>TableCaptionAlign Example</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>

    <h3>TableCaptionAlign Enumeration Example</h3>
    <!-- Scope attribute added for accessibility -->
    <asp:table id="Table1" runat="server" CellPadding="4"
      caption="City Postal Codes" CellSpacing="1"
      captionalign="Right" gridlines="Both">
    <asp:TableRow>
      <asp:TableHeaderCell id="CityHeader" Scope="Column">
        City Name
      </asp:TableHeaderCell>
      <asp:TableHeaderCell id="ZipHeader" Scope="Column">
        ZIP Code
      </asp:TableHeaderCell>
    </asp:TableRow>
    <asp:TableRow>
      <asp:TableCell>
        Redmond
      </asp:TableCell>
      <asp:TableCell>
        98052
      </asp:TableCell>
    </asp:TableRow>
    <asp:TableRow>
      <asp:TableCell>
        Albany
      </asp:TableCell>
      <asp:TableCell>
        12222
      </asp:TableCell>
    </asp:TableRow>
    </asp:table>

    </div>
    </form>
  </body>
</html>
<%@ page language="VB" %>
<!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="Head1" runat="server">
    <title>TableCaptionAlign Example</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>

    <h3>TableCaptionAlign Enumeration Example</h3>
    <!-- Scope attribute added for accessibility -->
    <asp:table id="Table1" runat="server" CellPadding="4"
      caption="City Postal Codes" CellSpacing="1"
      captionalign="Right" gridlines="Both">
    <asp:TableRow>
      <asp:TableHeaderCell id="CityHeader" Scope="Column">
        City Name
      </asp:TableHeaderCell>
      <asp:TableHeaderCell id="ZipHeader" Scope="Column">
        ZIP Code
      </asp:TableHeaderCell>
    </asp:TableRow>
    <asp:TableRow>
      <asp:TableCell>
        Redmond
      </asp:TableCell>
      <asp:TableCell>
        98052
      </asp:TableCell>
    </asp:TableRow>
    <asp:TableRow>
      <asp:TableCell>
        Albany
      </asp:TableCell>
      <asp:TableCell>
        12222
      </asp:TableCell>
    </asp:TableRow>
    </asp:table>

    </div>
    </form>
  </body>
</html>

Remarks

The TableCaptionAlign enumeration represents the horizontal or vertical placement of the HTML caption element in controls that can be rendered as tables, such as Table, GridView, DetailsView, or Calendar. For example, the CaptionAlign property uses these enumeration values to set the caption alignment in a Table control.

If you specify NotSet, the browser in which the control is rendered determines where to align the caption.

The CaptionAlign property specifies the position of the caption element with respect to controls that can be rendered as tables. The Caption property specifies the text to display in the caption element. Assistive technology devices can use the description provided by the Caption property to make the control more accessible. For example, a screen reader device might read the caption to the user to provide them with a description of the table.

Applies to

See also