Hello.
I have a DateTimePicker control with set MinDate to "DateTime.Now". When a user selects a date, the calendar sets the time to 00:00, by default.
Problem is: when a user selects today's date it will be invalid. So, I'd like to intercept this somehow and set the date to MinDate instead. The same thing is with the time picker - if user selects a time that is bellow minimum, I'd rather reset it to minimum value then getting the invalid red border.
Here's a code I've tried, I guess I'm doing something wrong:
<script language="javascript"> |
function In_DateSelected(sender, e) |
{ |
var calendarIn = $find("<%= dateTimeIn.ClientID %>"); |
var newDate = e.get_newDate(); |
if(newDate == null) |
{ |
newDate = calendarIn.get_minDate(); |
calendarIn.set_selectedDate(newDate); |
} |
} |
</script> |
<telerik:RadDateTimePicker ID="dateTimeIn" runat="server" Width="220px" EnableTyping="false" ClientEvents-OnDateSelected="In_DateSelected" /> |