How to define Calendar business and non-business days
Last revision: Feb 15, 2010
The default rules for determining business days in DayPilot Calendar are as follows:
- All weekend time slots (Saturday and Sunday) are marked as non-business.
- On workdays, only the slots between BusinessBeginsHour and BusinessEndsHour are marked as business.
If you need to define custom rules you have two options:
- Change BusinessBeginsHour and BusinessEndsHour. This will affect all workdays the same way.
- Handle BeforeCellRender event and override the status of individual time slots using e.IsBusiness. This will allow you to have different working hours each days and include/exclude individual days.
Example:
protected void DayPilotCalendar1_BeforeCellRender(object sender, BeforeCellRenderEventArgs e)
{
// Turn Saturday and Sunday into business days
if ((e.Start.DayOfWeek == DayOfWeek.Saturday || e.Start.DayOfWeek == DayOfWeek.Sunday)
|| (e.Start.Hour >= DayPilotCalendar1.BusinessBeginsHour && e.Start.Hour < DayPilotCalendar1.BusinessEndsHour))
{
e.IsBusiness = true;
}
}
Controls: Calendar
Related