NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Introduction to the Calendar Web Control

The Calendar Web control can serve these purposes:

The Calendar Web control is based around the NGWS DateTime object, and therefore supports the full range of dates allowed by that object. Effectively, you can display virtually any date between the years 0 and 9999 A.D.

The Calendar control is rendered as an HTML table when the Web Forms page runs. Therefore, a number of the control's properties pertain to various aspects of table formatting. A few of these properties are not fully supported in some older browsers, so some formatting features will not be available.

Developing with the Calendar Web Control

The following sections contain details about how the Calendar Web control works and an overview of tasks you can accomplish with it.

Displaying and Selecting Dates

The Calendar Web control displays a month of dates at a time, with a total of six weeks appearing at once. Within the control, there are several types of dates that you can work with:

Enabling Date Selection

By default, the calendar allows users to click an individual date to select it. If you are using the control as a read-only calendar, you can disable all date selection.

If day selection is enabled, each day of the calendar contains a LinkButton Web control that raises an event when clicked. If you enable week or month selection, a column of links is added to the left side of the calendar to enable the user to specify what week to select.

Customizing the Calendar's Appearance

You can set calendar properties to change the colors, size, text, and other visual features of the calendar. There are a number of ways to do this:

Capturing User Interaction with the Calendar Web Control

The Calendar Web control raises an event when the user selects an individual date or range of dates, or when navigating to a new month. By creating handlers for these events, you can determine what day or dates the user has selected and respond appropriately.

By creating custom day output, you can include arbitrary HTML in the calendar, including other controls.

Displaying Information from a Database in the Calendar Control

A common scenario is to display information from a database in the calendar. For example, an events calendar is often based out of information kept in a database.

The Calendar control does not directly support databinding — that is, you do not bind the calendar as a whole to a data source. Instead, you create a handler for the control's OnDayRender event, which is raised as each day in the current calendar month (view) is being rendered. In the handler for this event, you can extract information from a data source and add it to the stream being sent to the browser.

See Also

Using the Calendar Web Control