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

Reset RadDateTimePicker to default Value on client side

4 Answers 219 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Christoph
Top achievements
Rank 1
Christoph asked on 02 Dec 2010, 03:12 PM
Hi,

I populate the RadDateTimePicker with a default date on the server side.

The control is rendered and the user can modify the date, but should be able to restore the control to its default value.

I couldn't find a client side function which covers this. I have tried to use the defaultValue of the HTML textbox element which I can get via
- $find(dtp.ClientID).get_textBox() -
but the value is stored in the wrong format to do a Date.parse(datetime_string) and I don't want to spend lots of time on this issue.

What would be the suggested way?

Thanks.

Kind regards,
Christoph

4 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 03 Dec 2010, 11:51 AM
Hello Christoph,


Use the set_selectedDate() method to set date in DatePicker. Check the documentation for some sample code regarding this.
Client-Side Basics
RadDatePicker Client Object


-Shinu.
0
Christoph
Top achievements
Rank 1
answered on 03 Dec 2010, 12:30 PM
Hi Shinu,

Thank you for your reply.

I do use set_selectedDate() but I want to be able to restore the RadDateTimePicker to its default value.

The default value is the value the control gets assigned on the server side and is displayed to the user the first time the page is rendered.

The question is whether the RadDateTimePicker has a built-in mechanism on the client side to restore to this default value after the user has selected a different datetime.

I can surely add some hidden input, Date.parse() etc. but I first wanted to check whether I have missed something in the API or someone else came across the same requirement.

Kind regards,
Christoph
0
Maria Ilieva
Telerik team
answered on 07 Dec 2010, 04:30 PM
Hello Christoph,

The RadDateTimePicker does not implement such built-in mechanism for restoring the default value. As you already mentioned possible options could be to use hidden field, Date.parse or other similar way for restoring the needed value.

Greetings,
Maria Ilieva
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Christoph
Top achievements
Rank 1
answered on 08 Dec 2010, 08:56 AM
Hi Maria,

Thank you for posting - that answers my question.

Kind regards,
Christoph
Tags
Calendar
Asked by
Christoph
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Christoph
Top achievements
Rank 1
Maria Ilieva
Telerik team
Share this question
or