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

RadDatePicker set_selectedDate problem

4 Answers 1202 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Javier
Top achievements
Rank 2
Javier asked on 18 Jul 2008, 02:42 PM
I am trying to set the selected Date via client-side using the javascript method, but when the even is fired I get the following jscript exception:

Microsoft JScript runtime error: Object doesn't support this property or method

This is my javascript code in the web page:

var raddatepickerDueDate = $find("<%= raddatepickerDueDate.ClientID %>");
raddatepickerDueDate.set_selectedDate(
'2008/1/1'); 

but the debugger stops in this line of the control js code:

var y=""+_43.getFullYear(); 

the next six lines also do the same if you continue executing the code, with

var M=_43.getMonth()+1;
var d=_43.getDate();
var E=_43.getDay();
var H=_43.getHours();
var m=_43.getMinutes();
var s=_43.getSeconds(); 

I checked the type of the _43 variable on the debugger and VS tells me is a String..

Any idea what am I doing wrong?


4 Answers, 1 is accepted

Sort by
0
Javier
Top achievements
Rank 2
answered on 18 Jul 2008, 02:52 PM
I answer myself,
the set_selectedDate(Date) method takes a Date object as paramenter instead of a String, the right syntax is:

raddatepickerDueDate.set_selectedDate(new Date('2008/1/1')); 

thanks anyway

0
Joe
Top achievements
Rank 1
answered on 28 Aug 2008, 12:04 PM
I'm trying to do the same thing but get an "object expected" error on the following:

var

datepicker = $find("<%= rdIDCloseDate.ClientID %>");

where rdIDCloseDate is defined as follows:

<rad:RadDatePicker ID="rdIDCloseDate" runat="server" Calendar-Skin="Vista" Width="150px"

DateInput-EnabledStyle-HorizontalAlign="Right"

DateInput-DateFormat="MM/dd/yyyy" DateInput-Enabled="true"

Calendar-EnableNavigationAnimation="True" MaxDate="01/01/2099" MinDate="01/01/1900"

Calendar-EnableMultiSelect="False" Calendar-AutoPostBack="false" DateInput-AutoPostBack="false">

<DateInput ID="DateInput10" runat="server" DateFormat="MM/dd/yyyy" DisplayDateFormat="MM/dd/yyyy" MaxDate="01/01/2099" MinDate="01/01/1900" />

<Calendar ID="Calendar10" runat="server" Skin="Vista" />

<DatePopupButton />

</rad:RadDatePicker>

All I want to do is set the value of rdIdCloseDate to blank or null when a user clicks a corresponding checkbox.

Thanks for any help

0
Vlad
Telerik team
answered on 28 Aug 2008, 12:10 PM
Hello Joe,

Generally you can use $find() method only with ASP.NET AJAX version of our controls. Here is an article how to do the same for the old "Classic" controls:
http://www.telerik.com/help/aspnet/calendar/cldclientsideapi.html

Regards,
Vlad
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
ashish
Top achievements
Rank 1
answered on 20 May 2009, 07:04 AM
i have to set the date for another radDatePicker control like this

calendar.set_selectedDate (

new Date(newMinDateArray));

 


is it will work..

Tags
Calendar
Asked by
Javier
Top achievements
Rank 2
Answers by
Javier
Top achievements
Rank 2
Joe
Top achievements
Rank 1
Vlad
Telerik team
ashish
Top achievements
Rank 1
Share this question
or