Hi all,
I am currently using the OnDayRender event of the Calendar of my RadDatePicker which executes normally but, on a number of times only. My objective is to disable dates which are already taken and enable only Sundays for selection. So here's my code:
The above block of code runs just what it is expected to do, but it seems to trigger only for 30 number of days, maybe, after that it stops executing and then leaving other Sundays as enabled where it should not be. What can you suggest with this? I have searched the web with the server-side event of on month/year changed so that each time the month or year is selected it will disable the specific calendar days but found nothing.
Thanks for your response!
I am currently using the OnDayRender event of the Calendar of my RadDatePicker which executes normally but, on a number of times only. My objective is to disable dates which are already taken and enable only Sundays for selection. So here's my code:
protected
void
Calendar_OnDayRender(
object
sender, Telerik.Web.UI.Calendar.DayRenderEventArgs e)
{
// disable all days except Sunday
if
(e.Day.Date.DayOfWeek != DayOfWeek.Sunday)
{
CalendarDatesDisabler(sender, e);
}
// for Sundays, disable the dates already taken in the records
// if no records with this date do not disable
else
// if (e.Day.Date.DayOfWeek == DayOfWeek.Sunday)
{
if
(_dtForCalendarDayRender.Rows.Count > 0)
{
if
(_dtForCalendarDayRender.Select(
string
.Format(
"startdate = '{0:MM/dd/yyyy}'"
, e.Day.Date)).Length == 0)
return
;
CalendarDatesDisabler(sender, e);
}
}
}
The above block of code runs just what it is expected to do, but it seems to trigger only for 30 number of days, maybe, after that it stops executing and then leaving other Sundays as enabled where it should not be. What can you suggest with this? I have searched the web with the server-side event of on month/year changed so that each time the month or year is selected it will disable the specific calendar days but found nothing.
Thanks for your response!