This is a migrated thread and some comments may be shown as answers.

RadDateTimePicker and minDate

4 Answers 379 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Hemika
Top achievements
Rank 1
Hemika asked on 30 May 2013, 12:51 PM
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);

4 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 30 May 2013, 01:33 PM
Hi,

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

Thanks,
Princy.
0
Hemika
Top achievements
Rank 1
answered on 30 May 2013, 01:51 PM
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.
0
Hemika
Top achievements
Rank 1
answered on 05 Jun 2013, 04:16 AM
Need a solution to this. Urgent. 
0
Viktor Tachev
Telerik team
answered on 07 Jun 2013, 11:38 AM
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.
Tags
Calendar
Asked by
Hemika
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Hemika
Top achievements
Rank 1
Viktor Tachev
Telerik team
Share this question
or