I have a textbox that has a calendar control as part of the textbox so whenever you click in the textbox the calendar pops up. The problem is when the user changes the date to an invalid date the calendar shows "undefined NaN" (See Attachment). This happens even when the user is just deleting the year to change it.
The code is below...
How do I allow the user to manually change the date but not show the new date in the calendar until they hit enter? They also need to be able to select the date from the calendar and populate the textbox.
Thanks,
Gary
Hello Gary,
Thank you for posting in our community!
It is best using WebMonthCalendar with a WebDatePicker and pass the DropDownCalendarID to the picker.
In case you are using an older version of the product, I suggest you to consider upgrading to the Aikido based controls. You can take a look at the available online samples for the calendar here and for the WebDatePicker here.
In case upgrading is not an option, you can search through the existing topics for similar issues already discussed. For example à Display Selected Date from Webcalendar in ASP.NET textbox
Thank you for the reply.
Upgrading is not an option.
I have looked through the other topics but I cannot find one that relates to my question. I do not want the calendar date to change when the textbox does, but I do want the textbox to change when the calendar does.
Hello,
I am not much aware of this deprecated control set and yet, it could be possible to cancel an appropriate client side event when typing into the textbox, so the change is not reflected in the calendar.
In case you want to update a simple textbox with the currently selected day from the Month Calendar, I suggest you to handle the SelectedDateChanged Event and access the NewDate. From this point on, you can pass this date to the textbox. A similar approach is discussed here: https://www.infragistics.com/community/forums/f/ultimate-ui-for-asp-net/90294/how-to-get-selected-date-from-webmonthcalendar-using-javascript
For reference, the old APIs could be found here, and here.