Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

TableCaptionAlign Enumeration

Note: This enumeration is new in the .NET Framework version 2.0.

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

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

public enum TableCaptionAlign
public enum TableCaptionAlign
public enum TableCaptionAlign
 Member nameDescription
BottomThe caption element is aligned with the bottom of the table. 
LeftThe caption element is aligned with the left side of the table. 
NotSetThe caption alignment is not set. The browser that renders the caption determines where to align the caption. 
RightThe caption element is aligned with the right side of the table. 
TopThe caption element is aligned with the top of the table. 

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.

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#" %>

<script runat="server">

</script>

<html>
  <head id="Head1" runat="server">
      <title>TableCaptionAlign Example</title>
  </head>
  <body>
    <form id="Form1" runat="server">
    <h3>TableCaptionAlign Enumeration Example</h3>
      <asp:table id="Table1" 
        runat="server" 
        caption="ZIP Code and City Mapping" 
        captionalign="Left" 
        gridlines="Both">
        <asp:TableRow id="TableRow1" 
          runat="server">
          <asp:TableCell id="TableCell1" 
            runat="server">
            City Name
          </asp:TableCell>
          <asp:TableCell id="TableCell2" 
            runat="server">
            ZIP Code
          </asp:TableCell>
        </asp:TableRow>
        <asp:TableRow id="TableRow2" 
          runat="server">
          <asp:TableCell id="TableCell3" 
            runat="server">
            Redmond
          </asp:TableCell>
          <asp:TableCell id="TableCell4" 
            runat="server">
            98052
          </asp:TableCell>
        </asp:TableRow>
        <asp:TableRow id="TableRow3" 
          runat="server">
          <asp:TableCell id="TableCell5" 
            runat="server">
            Albany
          </asp:TableCell>
          <asp:TableCell id="TableCell6" 
            runat="server">
            12222
          </asp:TableCell>
        </asp:TableRow>
      </asp:table>
    </form>
  </body>
</html>

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.