Calendar.SelectedDates Property
.NET Framework 2.0
Gets a collection of selected dates from the ASP.NET SelectedDatesCollection class.
Namespace: System.Web.UI.MobileControls
Assembly: System.Web.Mobile (in system.web.mobile.dll)
Assembly: System.Web.Mobile (in system.web.mobile.dll)
The following code example demonstrates how to use the SelectedDates property to select all the Wednesdays in the current month. This example is part of a larger code sample for the Calendar overview.
protected void Command1_Click(object sender, EventArgs e) { int currentDay = Calendar1.VisibleDate.Day; int currentMonth = Calendar1.VisibleDate.Month; int currentYear = Calendar1.VisibleDate.Year; Calendar1.SelectedDates.Clear(); // Add all Wednesdays to the collection. for (int i = 1; i <= System.DateTime.DaysInMonth(currentYear, currentMonth); i++) { DateTime targetDate = new DateTime(currentYear, currentMonth, i); if (targetDate.DayOfWeek == DayOfWeek.Wednesday) Calendar1.SelectedDates.Add(targetDate); } TextView1.Text = "Selection Count =" + Calendar1.SelectedDates.Count.ToString(); }
Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.
Community Additions
ADD
Show: