Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
90
Disable weekends WebDatePicker
posted

Hi

I need to do in the control WebDatePicker disable or block the sundays and saturdays, how can i do it this.

Thanks for any help.

Best regards

Parents
No Data
Reply
  • 29417
    Offline posted

    Hello Ricardo, 

    Thank you for posting in our forum. 

    You can disable specific days by handling the WebMonthCalendar’s RenderDay client side event.

    In it you can check whether the rendered days in the calendar are weekend days and set them as disabled if they are.

     

    In order to add a handler for the WebDataPicker’s calendar you can add a WebMonthCalendar to your page and set for the WebDataPicker the DropDownCalendarID property so that it matches the id of the WebMonthCalendar control. For example:

      <ig:WebDatePicker ID="WebDatePicker1" runat="server" DropDownCalendarID="WebMonthCalendar1">

            </ig:WebDatePicker>

            <ig:WebMonthCalendar ID="WebMonthCalendar1" runat="server">

                <ClientEvents RenderDay="RenderDay" />

            </ig:WebMonthCalendar>

      

    The RenderDay client side event will fire for each day that’s rendered in the calendar. You can check if the currentDay is a weekend day (Saturday or Sunday) and set those days as disabled. For example the code would look like this:

    function RenderDay(sender, e) {

                if (e.get_day().isWeekend()) {

                    e.get_day().set_disabled(true);

                }

            }

     

     

    Let me know if you have any questions or concerns.

     

    Best Regards,

    Maya Kirova

    Developer Support Engineer II

    Infragistics, Inc.

    http://ko.infragistics.com/support

     

Children