Hello,
Is there a way to automatically disable any past days and time slots in the RadScheduler? I have a function that does the calculation, but it seems unreliable. Sometimes if the user performs certain actions, the past time slots will become active again. I'll post my code below.
if (this.radScheduler.SchedulerElement.ViewElement is SchedulerDayViewElement) |
{ |
SchedulerDayViewElement dayView = this.radScheduler.SchedulerElement.ViewElement as SchedulerDayViewElement; |
if (dayView != null) |
{ |
foreach (RadElement element in dayView.DataAreaElement.Table.Children) |
{ |
SchedulerCellElement cell = element as SchedulerCellElement; |
if (cell != null) |
{ |
if (cell.Date <= DateTime.Now) |
{ |
cell.Enabled = false; |
cell.CanFocus = false; |
} |
else |
{ |
cell.Enabled = true; |
cell.CanFocus = true; |
} |
} |
} |
} |
} |
else if (this.radScheduler.SchedulerElement.ViewElement is SchedulerMonthViewElement) |
{ |
SchedulerMonthViewElement monthView = this.radScheduler.SchedulerElement.ViewElement as SchedulerMonthViewElement; |
foreach (RadElement element in monthView.MonthViewAreaElement.Children) |
{ |
if (element is MonthCellElement) |
{ |
MonthCellElement e = element as MonthCellElement; |
if (e.Date < DateTime.Now.Date) |
{ |
element.Enabled = false; |
} |
} |
} |
} |
Thanks!
Jeremy