Tuesday, February 9, 2010

AJAXToolkit:CalendarExtension usage simple example

Create a CSS stylesheet with name calendar.css and save to in the same directory having the asp.net web page in which you want to link it.
Copy and paste the following CSS code in calendar.css file.
CSS code:
.cal_Theme1 .ajax__calendar_container
{
background-color: #e2e2e2; border:solid 1px #cccccc;
}
.cal_Theme1 .ajax__calendar_header
{
background-color: #ffffff; margin-bottom: 4px;
}
.cal_Theme1 .ajax__calendar_title,
.cal_Theme1 .ajax__calendar_next,
.cal_Theme1 .ajax__calendar_prev
{
color: #004080; padding-top: 3px;
}
.cal_Theme1 .ajax__calendar_body
{
background-color: #e9e9e9; border: solid 1px #cccccc;
}
.cal_Theme1 .ajax__calendar_dayname
{
text-align:center; font-weight:bold; margin-bottom: 4px; margin-top: 2px;
}
.cal_Theme1 .ajax__calendar_day
{
text-align:center;
}
.cal_Theme1 .ajax__calendar_hover .ajax__calendar_day,
.cal_Theme1 .ajax__calendar_hover .ajax__calendar_month,
.cal_Theme1 .ajax__calendar_hover .ajax__calendar_year,
.cal_Theme1 .ajax__calendar_active
{
color: #004080; font-weight:bold; background-color: #ffffff;
}
.cal_Theme1 .ajax__calendar_today
{
font-weight:bold;
}
.cal_Theme1 .ajax__calendar_other,
.cal_Theme1 .ajax__calendar_hover .ajax__calendar_today,
.cal_Theme1 .ajax__calendar_hover .ajax__calendar_title
{
color: #bbbbbb;
}
HTML code for AJAX Calendar Control ASP.Net web page


AJAX Calendar Theme







TargetControlID="TextBox1" PopupPosition="Right">






Note: CssClass Property of ajaxToolkit CalendarExtender is set as cal_Theme1.
It will inherit the styles defined in the calendar.css file to change the look and feel of the calendar control.

ajaxtoolkit:calendarextension css properties

Calendar Css Classes

.ajax__calendar_container : The outer rectangular container that supplies the border around the calendar element. Child Css classes: .ajax__calendar_header,.ajax__calendar_body,.ajax__calendar_footer.
.ajax__calendar_header : A container element that holds the next and previous arrows and the title of the current view. Child Css classes: .ajax__calendar_prev, .ajax__calendar_title, .ajax__calendar_next.
.ajax__calendar_prev : An element that displays the arrow to view the previous set of data in the view(previous month/year/decade). Child Css classes: none.
.ajax__calendar_title : An element that displays the title of the current view (month name, year, decade). Child Css classes: none.
.ajax__calendar_next : An element that displays the arrow to view the previous set of data in the view (previous month/year/decade). Child Css classes: none.
.ajax__calendar_body : A container element that holds the days, months, and years panes. Also provides a fixed rectangle with hidden overflow that is used for transitioning between views (next/previous month, or days/months/years).Child Css class: .ajax__calendar_days, .ajax__calendar_months, .ajax__calendar_years.
.ajax__calendar_days : A container element that holds the layout for the days in a month. Child Css classes: .ajax__calendar_dayname, .ajax__calendar_day
.ajax__calendar_dayname : An element that displays the short name of the day of the week. Child Css classes: none.
.ajax__calendar_day : An element that displays the day of the month. Child Css classes: none
.ajax__calendar_months : A container element that holds the layout for the months in a year. Child Css classes: .ajax__calendar_month.
.ajax__calendar_month : An element that displays the month of the year. Child Css classes: none
.ajax__calendar_years : A container element that holds the layout for the years in a decade. Child Css classes: .ajax__calendar_year.
.ajax__calendar_year : An element that displays the year in a decade. Child Css classes: none
.ajax__calendar_footer : A container element that holds the current date. Child Css classes: .ajax__calendar_today.
.ajax__calendar_today : An element that displays the current date. Child Css classes: none.
.ajax__calendar_hover : This is applied to an element in the DOM above a day, month or year and is used to apply CSS attributes that show a hover state. Child Css classes: .ajax__calendar_day, .ajax__calendar_month, .ajax__calendar_year
.ajax__calendar_active : This is applied to an element in the DOM above a day, month or year and is used to apply CSS attributes that show the currently selected value. Child Css classes: .ajax__calendar_day, .ajax__calendar_month, .ajax__calendar_year.
.ajax__calendar_other : This is applied to an element in the DOM above a day or year that is outside of the current view (day not in the visible month, year not in the visible decade). Child Css classes: .ajax__calendar_day, .ajax__calendar_year.