DatePicker Calendar OnDayRender

2 posts, 0 answers
  1. Rory
    Rory avatar
    159 posts
    Member since:
    Jul 2007

    Posted 28 May 2008 Link to this post

    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> 

  2. Rory
    Rory avatar
    159 posts
    Member since:
    Jul 2007

    Posted 28 May 2008 Link to this post

    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.

Back to Top