Hello!
I have a requirement on my application that states no user can navigate to a date that falls within a specified interval (in this case a year, starting in September, for instance).
I manage to do this using pre-render event and setting the popup calendar min and max date properties. Using the popup works beautifully.
Now I need same functionality on the navigation buttons. I tried using NavigationCommand event, but when the command is NavigateToNextPeriodo or NavigateToPrevious period I can not do this, since I do not have a suitable date to compare with my interval, so I can decide to cancel or not the command. Like so:
Has anyone been on this kind of a picle? Is there any ideas on how to achieve this?
Thanks!
I have a requirement on my application that states no user can navigate to a date that falls within a specified interval (in this case a year, starting in September, for instance).
I manage to do this using pre-render event and setting the popup calendar min and max date properties. Using the popup works beautifully.
Now I need same functionality on the navigation buttons. I tried using NavigationCommand event, but when the command is NavigateToNextPeriodo or NavigateToPrevious period I can not do this, since I do not have a suitable date to compare with my interval, so I can decide to cancel or not the command. Like so:
if
(e.Command == SchedulerNavigationCommand.NavigateToNextPeriod ||
e.Command == SchedulerNavigationCommand.NavigateToPreviousPeriod ||
e.Command == SchedulerNavigationCommand.NavigateToSelectedDate ||
e.Command == SchedulerNavigationCommand.SwitchToSelectedDay)
{
using
(ServicoAnosLectivos servico =
new
ServicoAnosLectivos())
{
DateTime[] datas = servico.GetDatasAnoLectivo(ServicoTabelasBaseSistema.GetAnoLectivoActual(
true
));
if
(e.SelectedDate < datas[0] ||
e.SelectedDate > datas[1])
{
e.Cancel =
true
;
}
}
}
Has anyone been on this kind of a picle? Is there any ideas on how to achieve this?
Thanks!