CaptionAlign Property

Calendar.CaptionAlign Property

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

Gets or sets the alignment of the text that is rendered as a caption for the calendar.

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

public virtual TableCaptionAlign CaptionAlign { get; set; }
/** @property */
public TableCaptionAlign get_CaptionAlign ()

/** @property */
public void set_CaptionAlign (TableCaptionAlign value)

public function get CaptionAlign () : TableCaptionAlign

public function set CaptionAlign (value : TableCaptionAlign)

Property Value

A TableCaptionAlign value that indicates the alignment of the caption.

This property determines where the caption appears in relation to the Calendar control. The default value is NotSet, which lets the browser determine where to align the caption. The following table explains the relationship between the TableCaptionAlign value and the appearance of the caption.

TableCaptionAlign value



The caption appears at the bottom of the calendar, with the text centered.


The caption appears at the top of the calendar, with the text left-aligned.


The caption alignment is not set and is determined by the browser.


The caption appears at the top of the calendar, with the text right-aligned.


The caption appears at the top of the calendar with the text centered.

The following code example demonstrates how to use the CaptionAlign property to align a caption for a Calendar control.

<%@ Page Language="C#" AutoEventWireup="True" %>

   <script >  

   <form id="Form1" runat="server">
      <h3> Calendar Caption and Caption Align Example </h3>

      <asp:Calendar id="Calendar1"
            Caption="This calendar is used to demonstrate a calendar caption. It also shows
            how the caption can be aligned to the calendar, in this case to the right edge of
            the calendar."




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

Community Additions

© 2015 Microsoft