RadDateTimePicker and minDate

5 posts, 0 answers
  1. Hemika
    Hemika avatar
    38 posts
    Member since:
    Dec 2012

    Posted 30 May 2013 Link to this post

    Hello,
    I have a RadDateTimePicker used where the mindate is the current time and setting the selected datetime to the closest 30 minutes from the current time onwards. Even though I set the mindate to the current time. I am able to select an earlier time before the mindate value from the timeview. 

    ASP Markup : 
    <telerik:RadDateTimePicker ID="dpDate" runat="server" Width="190" TabIndex="19">
        <Calendar ID="ddCalendar" runat="server" EnableKeyboardNavigation="true">
        </Calendar>
        <DateInput ID="ddDate" runat="server" DateFormat="dd/MM/yyyy hh:mm tt">
        </DateInput>
        <TimeView ID="TimeView1" runat="server" Interval="00:30:00">
        </TimeView>
    </telerik:RadDateTimePicker>


    C# Code : 
    this.dpDate.MinDate = DateTime.Now;
    this.dpDate.SelectedDate = DateTime.Now.AddMinutes(30 - (DateTime.Now.Minute % 30)).AddSeconds(-DateTime.Now.Second).AddMilliseconds(-DateTime.Now.Millisecond);
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 30 May 2013 Link to this post

    Hi,

    Try setting 'StartTime' of TimeView to hide the earlier time.
    C#:
    this.RadTimePicker1.TimeView.StartTime = DateTime.Now.TimeOfDay;

    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Hemika
    Hemika avatar
    38 posts
    Member since:
    Dec 2012

    Posted 30 May 2013 Link to this post

    Thanks for the reply.
    I may have missed out a point there. The validation should only happen to the current day. On anyway from today onwards, I should be able to select any time. But not a day and time before the current day and time. The code you supplied will remove the time views for everyday. I want that to happen only to the current day,.

    Simply : I should not be allowed to pick a day and time before the current day time combination.

    Also I would be requiring the Client Side code as well.
  5. Hemika
    Hemika avatar
    38 posts
    Member since:
    Dec 2012

    Posted 04 Jun 2013 Link to this post

    Need a solution to this. Urgent. 
  6. Viktor Tachev
    Admin
    Viktor Tachev avatar
    1488 posts

    Posted 07 Jun 2013 Link to this post

    Hello,

    The scenario you describe is not supported by the RadDateTimePicker control. The TimeView is rendered on the server and it could not have different values only for the current date. You could validate the time after it is entered and if it does not satisfy a predefined condition prompt the user.

    I hope this information would be helpful to you.

    Regards,
    Viktor Tachev
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017