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

Calendar - onDayRender (client Event) -- why is args.Date null

1 Answer 88 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Debbie
Top achievements
Rank 1
Debbie asked on 30 Jan 2009, 04:45 PM
I'm using the example found here (http://www.telerik.com/community/code-library/aspnet-ajax/calendar/disabling-calendar-days.aspx) which shows how to use both the server-side and client-side dayrender events to disable weekends.

Seemed easy enough, but I can't figure out why when the clientevent triggers, args.Date is null.

Here is my code....
<script type="text/javascript">  
     // necessary to disable the weekends on client-side navigation  
     function OnDayRender(calendarInstance, args) {  
          
 
         // convert the date-triplet to a javascript date  
         // we need Date.getDay() method to determine   
         // which days should be disabled (e.g. every Saturday (day = 6) and Sunday (day = 0))                  
         var jsDate = new Date(args.Date[0], args.Date[1] - 1, args.Date[2]);  
         if (jsDate.getDay() == 0 || jsDate.getDay() == 6) {  
             var otherMonthCssClass = "otherMonth_" + calendarInstance.Skin;  
             args.Cell.className = otherMonthCssClass;  
             // replace the default cell content (anchor tag) with a span element   
             // that contains the processed calendar day number -- necessary for the calendar skinning mechanism   
             args.Cell.innerHTML = "<span>" + args.Date[2] + "</span>";  
             // disable selection and hover effect for the cell  
             args.Cell.DayId = "";  
         }  
     }  
            </script> 
 
 
<telerik:RadDatePicker runat="server" ID="datepickShipDate" Skin="Vista" Width="80px">  
                <Calendar ID="calShipDate" runat="server" Skin="Vista" ShowRowHeaders="false" BorderColor="SteelBlue" 
                    BorderStyle="Solid" BorderWidth="1px" DisabledDayStyle-ForeColor="Gray" OnDayRender="calShipDate_OnDayRender">  
                    <ClientEvents OnDayRender="OnDayRender"  /> 
                    </Calendar> 
                <DateInput ID="diShipDate" runat="server" onclick="showDatePicker(this)" /> 
                <DatePopupButton Visible="false" /> 
                  
            </telerik:RadDatePicker> 
 
 

1 Answer, 1 is accepted

Sort by
0
Debbie
Top achievements
Rank 1
answered on 30 Jan 2009, 04:50 PM
Found my problem....

I changed args.Date to args._date and it worked.
Tags
Calendar
Asked by
Debbie
Top achievements
Rank 1
Answers by
Debbie
Top achievements
Rank 1
Share this question
or