ASP.NET Tutorial

.NET Framework

ASP.NET Introduction

ASP.NET Web Forms

Standard Controls

Label Control

TextBox Control

Image Control

Button Controls

Redirecting User

Using HyperLinks

RadioButton Control

RadioButtonList

CheckBox Control

CheckBoxList Control

DropDownList

ListBox Control

ImageMap Control

Event-Driven Programming

ASP.NET Page Structure

IsPostBack

Master Page

View State

Visibility of Controls

Formatting Controls

Applying CSS

Dynamic CSS

Using Style Class

Themes and Skins

Panel Control

PlaceHolder Control

AdRotator Control

Calendar Control

File Upload, Virtual Path

Validation Controls

Page Navigation

User Control

Separating Code-Presentation

Overview of ADO.NET

Data Binding

DataBinding List Control

Calendar Control

The Calendar control is another ASP.NET rich control. It is used to display an interactive calendar in an ASP.NET page. It can also be customized to suit the requirements of the page. Users can select days, weeks, and months.
<asp:calendar id="cal1" runat="server"/>

This properties, methods, and events of this control are listed in Table

Property Description
CellSpacing Specifies number of pixels between cells.
CellPadding Specifies number of pixels between contents of a cell and its border.
DayNameFormat Sets format of day names. Possible values: FirstLetter, FirstTwoLetters, Full, Short (default).
FirstDayOfWeek Specifies the day to be displayed in the first column of the calendar. Possible values: Default (uses server’s local settings), and other full day names.
NextMonthText Gets or sets the text displayed for the next month link. You can also set an image using HTML <img src="image url"> tag.
NextPrevFormat Gets or sets the format of the next and previous month hyperlinks. Possible values: CustomText (default), FullMonth, ShortMonth.
PrevMonthText Gets or sets the text displayed for the previous month link. You can also set an image using HTML <img src="image url"> tag.
SelectedDate Gets or sets the selected date as DateTime value. Default is TodaysDate.
SelectedDates Gets a collection of DateTime items that represent the selected dates.
SelectionMode Specifies whether the user can select a single day, a week, or an entire month. Possible values: Day (default), DayWeek, DayWeekMonth, None.
SelectMonthText Contains HTML text displayed for selecting months when SelectionMode=DayWeekMonth.
SelectWeekText Contains HTML text displayed for selecting weeks when SelectionMode=DayWeekMonth or DayWeek.
ShowDayHeader If True, displays names of days of week.
ShowGridLines If True, shows lines around days.
ShowNextPrevMonth If True, displays Next Month and Previous Month links.
ShowTitle If True, displays calendar’s title.
TitleFormat Specifies how month name appears in title bar. Possible values: Month, MonthYear.
TodaysDate Specifies a DateTime value that sets the current date.
VisibleDate Specifies a DateTime value that sets the month to display.
Methods Description
OnDayRender Raises DayRender event.
OnSelectionChanged Raises OnSelectionChanged event.
OnVisibleMonthChanged Raises OnVisibleMonthChanged event.
Events Description
DayRender Raised before each day cell is rendered on the calendar.
SelectionChanged Raised when a new day, week, or month is selected.
VisibleMonthChanged Raised by clicking the Next Month, or Previous Month link.