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....
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> |