Skip Navigation LinksASP.Net 2.0 Training : ASP.Net Calendar
Banner for ASP.Net 2.0 training classes in Visual Basic 2005 

Skip Navigation Links
Visit my other site:

certification training

Free Flash tutorials and training

Free Dreamweaver Video Tutorials

Free PHP Training

Visual Basic Windows Training




If you like this site please link to it


Calendar

  • The Calendar control is used to display a calendar in the browser.
  • This control displays a one-month calendar that allows the user to select dates and move to the next and previous months.

Property

Description

CellPadding

The space, in pixels, between the cell walls and contents

CellSpacing

The space, in pixels, between cells

DayHeaderStyle

The style for displaying the names of the days

DayNameFormat

The format for displaying the names of the days. Can take one of the following values:

  • FirstLetter
  • FirstTwoLetters
  • Full
  • Short

DayStyle

The style for displaying days

FirstDayOfWeek

What should be the first day of week. Can take one of the following values:

  • Default
  • Monday
  • Tuesday
  • Wednesday
  • Thursday
  • Friday
  • Saturday
  • Sunday

id

A unique id for the control

NextMonthText

The text displayed for the next month link

NextPrevFormat

The format of the next and previous month links. Can take one of the following values:

  • ShortMonth
  • FullMonth
  • CustomText

NextPrevStyle

The style for displaying next and previous month links

OnDayRender

The name of the function to be executed when when each day cell is created

OnSelectionChanged

The name of the function to be executed when the user selects a day, week, or month

OnVisibleMonthChanged

The name of the function to be executed when the user navigates to a different month

OtherMonthDayStyle

The style for displaying days that are not in the current month

PrevMonthText

The text displayed for the previous month link

runat

Specifies that the control is a server control.  Must be set to "server"

SelectedDate

The selected date

SelectedDates

The selected dates

SelectedDayStyle

The style for selected days

SelectionMode

How a user is allowed to select dates. Can take one of the following values:

  • None
  • Day
  • DayWeek
  • DayWeekMonth

SelectMonthText

The text displayed for the month selection link

SelectorStyle

The style for the month and weeks selection links

SelectWeekText

The text displayed for the week selection link

ShowDayHeader

A Boolean value that specifies whether the days of the week header should be shown

ShowGridLines

A Boolean value that specifies whether the grid lines between days should be shown

ShowNextPrevMonth

A Boolean value that specifies whether the next and previous month links should be shown

ShowTitle

A Boolean value that specifies whether the title of the calendar should be shown

TitleFormat

The format for the title of the calendar. Can take one of the following values:

  • Month
  • MonthYear

TitleStyle

The style of the title of the calendar

TodayDayStyle

The style for today's date

TodaysDate

Today's date

VisibleDate

The date that specifies the month that is currently visible in the calendar

WeekendDayStyle

The style for weekends


Simplest Calendar example, try this:

1

<html>

2

<body>

3

<form runat="server">

4

<asp:Calendar runat="server" />

5

</form>

6

</body>

7

</html>

Save as: Calendar1.aspx

  • Add a new webform
  • Name it Calendar.aspx
  • Add a calendar control, name it myCalendar
  • Test it

It display the calendar with the current month

  • Click the arrow at the top right of the Calendar control

  • Select a scheme:

                 

Notice the various properties that were changed. You can change them further if you like

The follow allows you to show the current day differently

  • Add a label and button control, name the label lblDisplay

Double click the button and add this code:

lblDisplay.Text = "Date selected was " & myCalendar.SelectedDate.ToShortDateString()

  • Test it


      ASP.Net 2.0 tutorials & training