The class is used for the Calendar control, which displays a single
month of the year at a time and allows users to move forward and
backward from month to month and select one or more dates. The
SelectionMode property determines what type of
selections are allowed (day, week, or month). You can also create an
event handler for the DayRender event, use it to
examine each day in the calendar and decide if you would like to
apply special formatting, add additional content in the corresponding
table cell, or make the day unselectable.
The other properties of the calendar are used to customize its
appearance, allowing you to hide header and title information, choose
styles, and disable month-to-month navigation. Note that if you hide
the title portion by setting the ShowTitle
property to False, the month navigation controls
will also be hidden. You can also respond to a
SelectionChanged event that fires when the user
chooses a new date and the VisibleMonthChanged
event that fires when the user navigates to a different month.
public class Calendar : WebControl, System.Web.UI.IPostBackEventHandler {
// Public Constructors
public
Calendar ( );
// Public Instance Properties
public int
CellPadding {set; get; }
public int
CellSpacing {set; get; }
public TableItemStyle
DayHeaderStyle {get; }
public DayNameFormat
DayNameFormat {set; get; }
public TableItemStyle
DayStyle {get; }
public FirstDayOfWeek
FirstDayOfWeek {set; get; }
public string
NextMonthText {set; get; }
public NextPrevFormat
NextPrevFormat {set; get; }
public TableItemStyle
NextPrevStyle {get; }
public TableItemStyle
OtherMonthDayStyle {get; }
public string
PrevMonthText {set; get; }
public DateTime
SelectedDate {set; get; }
public SelectedDatesCollection
SelectedDates {get; }
public TableItemStyle
SelectedDayStyle {get; }
public CalendarSelectionMode
SelectionMode {set; get; }
public string
SelectMonthText {set; get; }
public TableItemStyle
SelectorStyle {get; }
public string
SelectWeekText {set; get; }
public bool
ShowDayHeader {set; get; }
public bool
ShowGridLines {set; get; }
public bool
ShowNextPrevMonth {set; get; }
public bool
ShowTitle {set; get; }
public TitleFormat
TitleFormat {set; get; }
public TableItemStyle
TitleStyle {get; }
public TableItemStyle
TodayDayStyle {get; }
public DateTime
TodaysDate {set; get; }
public DateTime
VisibleDate {set; get; }
public TableItemStyle
WeekendDayStyle {get; }
// Protected Instance Methods
protected override ControlCollection
CreateControlCollection ( );// overrides System.Web.UI.Control
protected bool
HasWeekSelectors (CalendarSelectionMode
selectionMode );
protected override void
LoadViewState (object
savedState ); // overrides WebControl
protected virtual void
OnDayRender (TableCell
cell , CalendarDay
day );
protected override void
OnPreRender (EventArgs
e ); // overrides System.Web.UI.Control
protected virtual void
OnSelectionChanged ( );
protected virtual void
OnVisibleMonthChanged (DateTime
newDate , DateTime
previousDate );
protected override void
Render (System.Web.UI.HtmlTextWriter
writer ); // overrides WebControl
protected override object
SaveViewState ( ); // overrides WebControl
protected override void
TrackViewState ( ); // overrides WebControl
// Events
public event DayRenderEventHandler
DayRender ;
public event EventHandler
SelectionChanged ;
public event MonthChangedEventHandler
VisibleMonthChanged ;
}