DekGenius.com
[ Team LiB ] Previous Section Next Section

CalendarDay

System.Web.UI.WebControls (system.web.dll)class

This class represents a single day in the Calendar control. You can use this class in the Calendar.DayRender event to programmatically configure specific dates. The Calendar.DayRender event fires once for each day in the Calendar, and it provides the CalendarDay object for that day. At this point, you can modify its properties.

For example, you can compare dates against valid date ranges stored in a database and set the IsSelectable property to False for all dates that you don't want the user to be able to select. Or you could examine the IsOtherMonth property to verify that the day is in the currently displayed month and the IsWeekend property to confirm that the day is on a weekend, and then change the background color of the containing cell to highlight it. Note, however, that the background color is not a property of the CalendarDay object. Instead, it is a property of the TableCell object that is also provided to you in the event through the DayRenderEventArgs class. For more information, refer to the DayRenderEventArgs object.

public class CalendarDay {
// Public Constructors
   public CalendarDay(DateTime date, bool isWeekend, bool isToday, bool isSelected, bool isOtherMonth, 
        string dayNumberText);
// Public Instance Properties
   public DateTime Date{get; }
   public string DayNumberText{get; }
   public bool IsOtherMonth{get; }
   public bool IsSelectable{set; get; }
   public bool IsSelected{get; }
   public bool IsToday{get; }
   public bool IsWeekend{get; }
}

Returned By

DayRenderEventArgs.Day

Passed To

Calendar.OnDayRender( ), DayRenderEventArgs.DayRenderEventArgs( )

    [ Team LiB ] Previous Section Next Section