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
325
Disable clicking on a date
posted

I want to display the WebMonthCalendar with only certain dates being clickable.  How can I do that. I tried using a custom day, but that doesn't seem to disable the day I don't want checked.

  • 29417
    Suggested Answer
    Offline posted

    Hello mario101 ,

     

    Thank you for your patience while I was looking into this.

     

    To disable a day from being selected you could handle the SelectionChanging event and in it if the date shouldn’t be selectable just cancel the event. For example this code:

     

    function WebMonthCalendar1_SelectionChanging(sender, eventArgs) {

        ///<param name="sender" type="Infragistics.Web.UI.WebMonthCalendar"></param>

           ///<param name="eventArgs" type="Infragistics.Web.UI.CalendarSelectionChangingEventArgs"></param>

     

        var calendar = sender;

        var currentDate = new Date();

        var selectedDate = eventArgs.get_dates();

        if (currentDate > selectedDate[0]) {

            eventArgs.set_cancel(true);   

        }

     

     

    Would cancel the selection of any date previous to the current one.

     

    Let me know if this would be applicable in your scenario. Also don’t hesitate to contact me if you have any further questions.

     

    Best Regards,

    Maya Kirova

    Developer Support Engineer

    Infragistics, Inc.

    http://ko.infragistics.com/support

     

  • 29417
    Offline posted

    Hello mario101 ,

    Thank you for writing in our forum.

    I'm currently looking into your issue and will notify you of my progress by tommorow.

    Best Regards,

    Maya Kirova

    Developer Support Engineer

    Infragistics, Inc.

    http://ko.infragistics.com/support