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

DatePicker Calendar OnDayRender

1 Answer 115 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Rory
Top achievements
Rank 1
Rory asked on 28 May 2008, 11:15 PM
Hi there,
I was using the RadDatePicker and customizing its Calender's innerHTML via the OnDayRender client side event. This seems to have changed with the latest Q1 release and no longer works. In the case of the 
OnDayRender(claendarInstance,args)
the args.get_date()[0] doesn't work because the args object appears to be a PopUpButton object and not the Date Triplet like it was before. So what the deuce? Can I get to the Date Triplet from the PopUpButton Args?

Here's my Code, the script that breaks on line 1 and the HTML that breaks it. Thanks.

function OnDayRender(calendarInstance, args)  
{  
  var jsDate = new Date(args.get_date()[0], args.get_date()[1] - 1, args.get_date()[2]);  
              
  args.get_cell().innerHTML = "<table cellpadding='2' cellspacing='0' width='100%' height='100%' class='contentTable' ><tr><td></td><td class='dateCell'>" + jsDate.getDate() + "</td></tr><tr><td colspan='2' class='countCell'>&nbsp;0</td></tr></table>";  
 
for(i = 0; i < arrDiaries.length; i++)  
{     
 var javaDueDate = new Date(arrDiaries[i].DiaryDate);    
 var simpleDate = (jsDate.getMonth() + 1) + "/" + jsDate.getDate() + "/" + jsDate.getYear();  
 var javaCurrentDate = new Date(simpleDate);  
    if(javaDueDate.toDateString() == javaCurrentDate.toDateString())  
    {  
     args.get_cell().innerHTML = "<table cellpadding='2' cellspacing='0' width='100%' height='100%' class='contentTable' ><tr><td></td><td class='dateCell'>" + jsDate.getDate() + "</td></tr><tr><td colspan='2' class='countCell'>" + arrDiaries[i].DiaryCount + "</td></tr></table>";  
 
     }  
}  


   
<telerik:RadDatePicker ID="sdpDueDate" runat="server"
    ClientEvents-OnDateSelected="OnDateSelected"   
    Skin="Office2007" 
    EnableTheming="false">  
  <Calendar ID="Calendar1" runat="server" 
      OnDayRender="Calendar_OnDayRender" 
      <ClientEvents OnDayRender="OnDayRender" /> 
  </Calendar> 
</telerik:RadDatePicker> 

1 Answer, 1 is accepted

Sort by
0
Rory
Top achievements
Rank 1
answered on 28 May 2008, 11:54 PM
OK,
I got it fixed. In order to edit the DatePicker Calendar onDayRender you should add a <telerik:RadCalendar ID="cal1"> to the page and in the DatePicker share to this Calendar with the SharedCalendarID="cal1". later.

Tags
Calendar
Asked by
Rory
Top achievements
Rank 1
Answers by
Rory
Top achievements
Rank 1
Share this question
or