This is a migrated thread and some comments may be shown as answers.

Disable holidays and Week ends in Date picker

3 Answers 298 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Dev
Top achievements
Rank 1
Dev asked on 22 Apr 2013, 05:07 PM
Hello,
I dont see any solution for disabling week ends and special days in date picker.
Any workarounds?
There is a solution for weekends, but we have to do server,client side code. But For special days?Holidays?
the special days are by a caculation on server side, so doing this on client side as well is going to be hard..:(
Shouldn't it be a simple propery to disable?

Thanks

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 23 Apr 2013, 07:00 AM
Hi,

You can try the approach mentioned in the following code library.
Disabling calendar days

Thanks,
Shinu
0
Dev
Top achievements
Rank 1
answered on 23 Apr 2013, 01:42 PM
Thanks Shinu.
But I already tried this with no luck. They just disabling the current month. If click next month then, could be able to select the disabled dates. This case, have to implement client side script to disable.
So i think, we need to do the same action at both client  and server side.
This will be an issue for us, as we are dynamically disable dates at server side.

Thanks.
0
Eyup
Telerik team
answered on 26 Apr 2013, 11:59 AM
Hello,

I have already replied to your query in your support ticket 686818. I will repeat the approach here so other users with similar issues make avail:
Does enabling the AutoPostBack property of the calendar works for you?
<telerik:RadCalendar ID="RadCalendar3" runat="server" OnDayRender="RadCalendar3_DayRender" AutoPostBack="true">
</telerik:RadCalendar>
C#:
protected void RadCalendar3_DayRender(object sender, Telerik.Web.UI.Calendar.DayRenderEventArgs e)
{
    if (e.Day.IsWeekend)
    {
        RadCalendarDay weekendDay = new RadCalendarDay();
        weekendDay.Date = e.Day.Date;
        weekendDay.IsSelectable = false;
        (sender as RadCalendar).SpecialDays.Add(weekendDay);
    }
}

Hope this helps.

Regards,
Eyup
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Calendar
Asked by
Dev
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Dev
Top achievements
Rank 1
Eyup
Telerik team
Share this question
or