Disable Date-Selection on Calendar Form Control

Sharon Parry asked on August 22, 2016 02:45

Hi,

Is it possible to actually disable date selection for specific dates using the Calendar form control? I know that I can setup validation rules so that invalid (or unavailable) dates are rejected before the form is submitted, but what I want to do is completely disable specific dates on the calendar so that user cannot even select them.

Scenario:

I've got a custom module where editor creates facility bookings with each record containing a Date In and Date Out field. Using the standard asp:calendar control in a user-control for general display on the public page, I can "block out" dates (after getting dates from the custom module) by changing the cell ForeColor and BackColor in the asp:calendar's DayRender().

Public users can send a booking request by submitting relevant info via a form created in the Form application. (The form data isn't linked to the custom module - editors will be managing custom module records manually, so there's no requirement to link submitted form data to the custom module data.)

So, I'm now trying to get the same behaviour for the (cloned) Calendar form control - ie, be able to have dates < today as well as dates from the custom module as disabled (and, hopefully also change ForeColor and BackColor for the dates from the custom module).

Sharon.

Recent Answers


Trevor Fayas answered on August 23, 2016 15:50

Through Kentico's default calendar picker, i do not believe so. Here's some great options though.

1: Set the form control to a textbox, and then use your own Date Selector (bootstrap's DateTime picker is pretty nice and has a great API that should be able to do what you want it to)

2: Clone the Calendar Form Control and modify it to add in the features you want, or build your own Custom Form Control. There's info on how to do this in the documentation, it's pretty easy!

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.