The calendar is used to show different states shown as with different background colors. In the codebehind DayRender event i set up the Background color setting the Cell CssClass for each day...
now its possible for the user to change the state on a date by clicking it. Here is the question. ? If a date has a specific color "lets say green" and the user clicks it i want to show a confirm messagebox. How do i get the clicked dates backgroundcolor in the ClientEvent.
my aspx looks like below:
<telerik:RadCalendar ID="uiCalendarPersonal" runat="server" AutoPostBack="True" width="170px"
ClientEvents-OnDateClick="OnDateClick"
OnDayRender="uiCalendarPersonal_DayRender">
</telerik:RadCalendar>
The javascript for OnDateClick will look something like this
function OnDateClick(calendarInstance, args) {
//set set_Cancel(true) to cancel AutoPostBackOnDayClick - if any;
// here i would like to check for the clicked dates backgroundcolor
args.set_cancel(!TraceEvent("OnDateClick: " + args.get_renderDay().get_date(), "Postback?"));
}
function TraceEvent(eventName, confirmMessage) {
var now = new Date();
var str = "[" + now.toLocaleTimeString() + "] " + eventName;
var retValue;
if (confirmMessage) {
retValue = confirm(eventName + ":\n" + confirmMessage);
str += (retValue ? "" : " - canceled");
}
if (retValue != null)
return retValue;
}