Hello,
I'm having issues when setting the selected and minimum dates on a RadDateTimePicker client-side.
I've two RadDateTimePickers, one for setting the starting datetime (dtpBegin) and other for the ending (dtpEnd) declared as follows:
When selecting the starting datetime, I'd like to set the selected value as minimum on the ending control and also would like to set a valid value for that control (say the starting datetime plus 1 minute). To do that, I've the following code client-side:
Now, even though the calls to set_minDate and setTime are not throwing any errors, the selected date on dtpEnd is not changed neither is the minimum date time set. One thing I find weird is that after setting the time on dtpEnd, if I run on Firebug's console:
I get null.
And regarding the minimum date, if I run on Firebug's console:
I get the expected value (even though the calendar allows to select any value).
One extra thing that might be useful for troubleshooting is that I'm also setting the MinDate server-side for these two controls (setting it to DateTime.Now to forbid users selecting past datetimes).
Thanks a lot,
Diego.
I'm having issues when setting the selected and minimum dates on a RadDateTimePicker client-side.
I've two RadDateTimePickers, one for setting the starting datetime (dtpBegin) and other for the ending (dtpEnd) declared as follows:
<
telerik:RadAjaxPanel
ID
=
"RadAjaxPanel1"
runat
=
"server"
LoadingPanelID
=
"RadAjaxLoadingPanel1"
>
......
<
telerik:RadDateTimePicker
ID
=
"dtpBegin"
runat
=
"server"
>
<
ClientEvents
OnDateSelected
=
"startDateTimeSelected"
OnPopupClosing
=
"startDateTimePopupClosing"
/>
</
telerik:RadDateTimePicker
>
<
telerik:RadDateTimePicker
ID
=
"dtpEnd"
runat
=
"server"
>
<
ClientEvents
OnPopupClosing
=
"endDateTimePopupClosing"
/>
</
telerik:RadDateTimePicker
>
</
telerik:RadAjaxPanel
>
<
telerik:RadScriptBlock
runat
=
"server"
>
<
script
type
=
"text/javascript"
>
var endDateTimePickerId = "<%= dtpEnd.ClientID %>";
</
script
>
</
telerik:RadScriptBlock
>
When selecting the starting datetime, I'd like to set the selected value as minimum on the ending control and also would like to set a valid value for that control (say the starting datetime plus 1 minute). To do that, I've the following code client-side:
function
startDateTimeSelected(sender, e) {
if
(e.get_newDate != undefined && e.get_newDate() !=
null
) {
var
startDate = e.get_newDate();
var
endDateTimePicker = $find(endDateTimePickerId);
endDateTimePicker.set_minDate(e.get_newDate());
if
(endDateTimePicker.get_timeView().getTime() < startDate) {
var
timeView = timePicker.get_timeView();
timeView.setTime(newDate.getHours(), newDate.getMinutes() + 1, newDate.getSeconds(), newDate);
}
}
}
Now, even though the calls to set_minDate and setTime are not throwing any errors, the selected date on dtpEnd is not changed neither is the minimum date time set. One thing I find weird is that after setting the time on dtpEnd, if I run on Firebug's console:
$find(endDateTimePickerId).get_timeView().getTime()
And regarding the minimum date, if I run on Firebug's console:
$find(endDateTimePickerId).get_minDate()
I get the expected value (even though the calendar allows to select any value).
One extra thing that might be useful for troubleshooting is that I'm also setting the MinDate server-side for these two controls (setting it to DateTime.Now to forbid users selecting past datetimes).
Thanks a lot,
Diego.