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

DateTimePicker get selected time value at server

2 Answers 155 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jon
Top achievements
Rank 1
Jon asked on 06 May 2009, 06:17 PM

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>

 

 

 

 

2 Answers, 1 is accepted

Sort by
0
Accepted
Georgi Krustev
Telerik team
answered on 11 May 2009, 12:44 PM
Hello Jon,

I will suggest you to examine this online demo which implements the desired functionality.
Please give a try and let me know if I can assist you additionally.

Regards,
Georgi Krustev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Jon
Top achievements
Rank 1
answered on 14 May 2009, 11:40 PM
Works! Thanks!
Tags
General Discussions
Asked by
Jon
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Jon
Top achievements
Rank 1
Share this question
or