You can disable dates within the C1Calendar control so that users cannot select them. This topic illustrates how to set disabled dates in Design view and in Source view. This topic assumes that you have created an AJAX-enabled ASP.NET project that contains a ScriptManager control (see Creating an AJAX-Enabled ASP.NET Project) and a C1Calendar control.
In Design View
Complete the following steps:
1. Click the Design tab to enter Design view.
2. Right-click the C1Calendar control and select Properties.
3.
In C1Calendar's
Properties window, select the DisabledDates
property and click the ellipsis button .
The C1Date Collection Editor appears.
4. In the C1Date Collection Editor dialog box, complete the following tasks:
a. Click Add twice to add two disabled dates to the calendar.
b. Select the first disabled date and set its Date property to “3/9/2009”.
c. Select the second disabled date and set its Date property to “3/10/2009”.
5. Open the project.
6. Use the calendar's navigation buttons to navigate to March of 2009. Try to select March 9th and 10th and observe that they're disabled.
In Source View
Complete the following steps:
1. Click the Source tab to switch to Source view.
2. Place the following markup between the <cc1:C1Calendar> and </cc1:C1Calendar> tags:
<DisabledDates>
<cc1:C1Date Date="2009-03-09" />
<cc1:C1Date Date="2009-03-10" />
</DisabledDates>
3. Open the project in a Studio for iPhone-compatible browser.
4. Use the calendar's navigation buttons to navigate to March of 2009. Try to select March 9th and 10th and observe that they're disabled.
In Code
Complete the following steps:
1. Import the following namespaces into your project:
Imports C1.Web.iPhone.C1Calendar
•C#
using C1.Web.iPhone.C1Calendar;
2. Add the following code to the Page_Load event to disable the dates:
C1Calendar1.DisabledDates.Add(new DateTime(2009, 3, 9))
C1Calendar1.DisabledDates.Add(new DateTime(2009, 3, 10))
•C#
C1Calendar1.DisabledDates.Add(new DateTime(2009, 3, 9));
C1Calendar1.DisabledDates.Add(new DateTime(2009, 3, 10));
3. Open the project in a Studio for iPhone-compatible browser.
4. Use the calendar's navigation buttons to navigate to March of 2009. Try to select March 9th and 10th and observe that they're disabled.