minimum value for datetimepicker (client side)

2 posts, 0 answers
  1. Alex Lawson
    Alex Lawson avatar
    43 posts
    Member since:
    May 2008

    Posted 07 Jul 2008 Link to this post

    I want to limit the entered time value to a min-max range fro the datetimepicker, so that if a user enters 7:03 am it will be corrected to 9:00am for example.

    Is this achievable in client side JS code?
  2. Daniel
    Daniel avatar
    4949 posts

    Posted 10 Jul 2008 Link to this post

    Hi Alex,

    It is possible to catch the ClientEvents of the DateInput as shown below:
    <telerik:RadDateTimePicker ID="RadDateTimePicker1" runat="server"
        <DateInput runat="server"
            <ClientEvents OnValueChanged="CheckTime" OnMouseOut="CheckTime"> </ClientEvents> 

    Afterward you can choose how to handle the event from JavaScript. Here is a possible approach:
    var time = new Date(sender.GetDisplayValue());  
    if(time < minTime) 
    else if (time > maxTime) 

    Kind regards,
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Back to Top