I would like to use a DateTimePicker to allow setting of both date and time, then, when a button is pressed, at the server, read the selected DateTime.
I have tried several different combinations, including the approach described here:
http://www.telerik.com/help/aspnet/calendar/cldpickerserverevents.html
with a javascript pop-up and AutoPostBackControl="Both" on the RadDateTimePicker.
When I click on the calendar, I can change the date, then, when Button is submitted, I can see that date as
RadDateTimePicker1.SelectedDate.Value, but when I update the time with the pop-up, the changed time is not reflected on postback.
Does use of a DateTimePicker require two DateInput controls? Is there a better demo/sample code to work from?
Thanks!
Some of the code:
<telerik:RadDateTimePicker ID="RadDateTimePicker1"
Style="vertical-align: middle;" Width="200px"
MinDate="2006-02-01" runat="server" SelectedDate="2006-04-01"
MaxDate="2099-12-16" OnRequestStart="OnRequestStart"
Culture="English (United States)" FocusedDate="2006-02-01" AutoPostBackControl="Both" >
<TimePopupButton ImageUrl="" HoverImageUrl=""></TimePopupButton>
<TimeView CellSpacing="-1" runat="server"
Interval="00:15:00"></TimeView>
<DateInput runat="server" onclick="ToggleDateTimePickerPopup()" DateFormat="D"
AutoPostBack="True">
</DateInput>
<Calendar runat="server"
UseRowHeadersAsSelectors="False" UseColumnHeadersAsSelectors="False" ViewSelectorText="x"></Calendar>
<DatePopupButton ImageUrl="" HoverImageUrl=""></DatePopupButton>
</telerik:RadDateTimePicker>
<script type="text/javascript">
function ToggleDateTimePickerPopup() {
$find(
"<%= RadDateTimePicker1.ClientID %>").showPopup();
}
function OnRequestStart(target, arguments) {
arguments.set_enableAjax(
false);
}
</script>
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>