I am designing a date time control using the raddatepicker. I want Sundays to be highlighted a different color than saturday, we are open on saturdays and closed on sundays. so mondays thru saturday (excluding holidays or special days) should be the same back ground color.
I've tried both the client and server side (OnDayRender) to control this but its too inconsistent.
What can i do differently? Attached is the vb and javascript i am using.
Tim Martin
Car Research
I've tried both the client and server side (OnDayRender) to control this but its too inconsistent.
What can i do differently? Attached is the vb and javascript i am using.
Tim Martin
Car Research
<
script
type
=
"text/javascript"
>
function OnDayRender(calendarInstance, args) {
6) and Sunday (day = 0))
var jsDate = new Date(args.get_date()[0], args.get_date()[1] - 1, args.get_date()[2]);
if (jsDate.getDay() == 0) {
var otherMonthCssClass = "CalendarDisabled";
args.get_cell().className = otherMonthCssClass;
args.get_cell().innerHTML = "<
span
>" + args.get_date()[2] + "</
span
>";
args.get_cell().DayId = "";
} else {
var otherMonthCssClass = "CalendarEnabled";
args.get_cell().className = otherMonthCssClass;
args.get_cell().innerHTML = "<
span
>" + args.get_date()[2] + "</
span
>";
}
}
</
script
>
Protected Sub Calendar_OnDayRender(ByVal sender As Object, ByVal e As Telerik.Web.UI.Calendar.DayRenderEventArgs)
Dim specialday As New RadCalendarDay
If e.Day.Date.DayOfWeek = DayOfWeek.Sunday Then
specialday.Date = e.Day.Date
specialday.IsSelectable = False
specialday.ToolTip = "Closed"
specialday.ItemStyle.CssClass = "CalendarDisabled"
With rdpDatePicker
.Calendar.SpecialDays.Add(specialday)
End With
ElseIf e.Day.Date.DayOfWeek = DayOfWeek.Saturday Then
specialday.Date = e.Day.Date
specialday.IsSelectable = True
specialday.ItemStyle.CssClass = "CalendarEnabled"
With rdpDatePicker
.Calendar.SpecialDays.Add(specialday)
End With
End If
End Sub