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

[Solved] DatePicker selected value

1 Answer 100 Views
Date/Time Pickers
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Arjuna
Top achievements
Rank 1
Arjuna asked on 28 Aug 2011, 02:42 AM

I want to get a selected value off a datepicker control.  The code I am using is

@Html.Telerik().DatePicker().Name("to").Format("dd-MM-yyyy").Value(DateTime.Now.Date)

 

The JavaScript code I am using is

var myDate = $('#to').data('tDatePicker').value();

However this throws a JavaScript error saying "Undefined"

1 Answer, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 29 Aug 2011, 11:34 AM
Hello Arjuna,

The code that you used is OK and should return the value. If you get an "undefined" error, this means that for some reason, you cannot reference the date picker - for example if you call the code too early.


Kind regards,
Georgi Tunev
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Tags
Date/Time Pickers
Asked by
Arjuna
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
Share this question
or