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

$find("raddatepickerID") always coming null

6 Answers 82 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Manoj
Top achievements
Rank 1
Manoj asked on 05 Mar 2009, 04:18 PM
I am using following code for Date picker but calendar object ($find(<%=RadCalendar1.ClientID%>)) is always coming null. So not able to attach event.
function onDateClickHandler1()
{
 
alert("First handler called");
}
function pageLoad()
{
 
var calendar = $find(<%=RadCalendar1.ClientID%>);
 calendar.add_dateClick(onDateClickHandler1);
}

6 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 06 Mar 2009, 04:57 AM
Hi Manoj,

Try putting the RadCalendar.ClientID in " or ' in order to pass it as string. I have tried this example and its is working fine for me.

ASPX:
<telerik:RadCalendar ID="RadCalendar1" runat="server" Font-Names="Arial, Verdana, Tahoma" 
    ForeColor="Black" Style="border-color: #ececec">  
</telerik:RadCalendar> 

JavaScript:
<script type="text/javascript">  
function onDateClickHandler1()  
{  
   alert("First handler called");  
}  
function pageLoad()  
{  
   var calendar = $find("<%=RadCalendar1.ClientID%>");  
   calendar.add_dateClick(onDateClickHandler1);  
}  
</script> 
Checkout the link Getting the client-side object

Thanks,
Princy.
0
Manoj
Top achievements
Rank 1
answered on 06 Mar 2009, 04:11 PM
I am getting following error with this code:

http://tinypic.com/view.php?pic=mw65hj&s=5 
0
Shinu
Top achievements
Rank 2
answered on 09 Mar 2009, 04:48 AM
Hello Manoj,

I guess you are using the ASP.NET version of RadControls, not the ASP.NET AJAx version. If so, you can try the following code and see whether its working for you. Could you provide the exact version of RadControls that you are using, in the case of any problem in executing the code?

JavaScript:
<script type="text/javascript">   
function onDateClickHandler1()   
{   
   alert("First handler called"); 
function pageLoad()   
{   
   var calendar = <%=RadCalendar1.ClientID%>;    
   calendar.AttachEvent("OnDateClick","onDateClickHandler1");   
}   
</script> 

Thanks,
Shinu.
0
Manoj
Top achievements
Rank 1
answered on 09 Mar 2009, 04:06 PM
Hi Shinu,

My project is in ASP.NET AJAx version(Ajax Ext.). How it is different from ASP.NET version of RadControls. How can I fix this problem by using ASP.NET AJAx version. I am using datepicker by adding 2 dlls.
0
Manoj
Top achievements
Rank 1
answered on 12 Mar 2009, 05:05 PM
Hi Shinu,

My project is in ASP.NET AJAx version(Ajax Ext.). How it is different from ASP.NET version of RadControls. How can I fix this problem by using ASP.NET AJAx version. I am using datepicker by adding 2 dlls.
0
Dimo
Telerik team
answered on 12 Mar 2009, 05:15 PM
Hello Manoj,

Please post a complete web page, so that we can see what exactly are you trying to do and where the problem comes from. Thanks.

Regards,
Dimo
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.
Tags
Calendar
Asked by
Manoj
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Manoj
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Dimo
Telerik team
Share this question
or