Hi , Can any one help me, i'm using RadDatePicker in this , i blocking some special days. special days blocking are working fine if i change the month from july to august its working fine . if i again change to august to july code blocking is there but images for that special days are not working. I'm also using autopostback="true". Here my code
<telerik:RadCodeBlock ID="myCodeBlock" runat="server"> <script type="text/javascript"> //<![CDATA[ function rdpDay_OnDateSelected(sender, e) { var myId = document.getElementById("<%= ddlTime.ClientID %>"); if (myId != null) { myId.style.display = "none"; } document.getElementById("<%= hfHideValue.ClientID %>").value = "Hidden"; } // 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]); var jsDate = new Date(args._date[0], args._date[1] - 1, args._date[2]); var disabledDays = document.getElementById("ctl00_cphMaster_hdDisableWeek").value; var mySplitResult = disabledDays.split(","); for (i = 0; i < mySplitResult.length; i++) { if (jsDate.getDay() == parseInt(mySplitResult[i])) { var otherMonthCssClass = "ColorGray"; 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 = ""; break; } } var blockedDays = document.getElementById("ctl00_cphMaster_hdBlockDays").value; var mySplitBlockDaysResult = blockedDays.split(","); for (i = 0; i < mySplitBlockDaysResult.length; i++) { var d = new Date(mySplitBlockDaysResult[i]); if (jsDate.toString() == d.toString()) { var otherMonthCssClass = "ColorRed"; 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 = ""; break; } } } //]]> </script> </telerik:RadCodeBlock><telerik:RadDatePicker ID="rdpDay" AutoPostBack="true" runat="server" CssClass="txtStyl" Width="120px" Skin="Office2007"> <DateInput ID="DateInput1" DisplayDateFormat="dd/MM/yyyy" DateFormat="dd/MM/yyyy" FocusedStyle-CssClass="txtStyl" EnabledStyle-CssClass="txtStyl" HoveredStyle-CssClass="txtStyl" EmptyMessage="dd/mm/yyyy" ForeColor="#666666" Font-Names="Arial,Helvetica,sans-serif" HideOnBlur="True" runat="server" ReadOnly="true" Style="font-size: 11pt; width: 75px;"> </DateInput> <Calendar OnDayRender="Calendar_OnDayRender" AutoPostBack="true" runat="server" Skin="Office2007"> <ClientEvents OnDayRender="OnDayRender" /> </Calendar> <ClientEvents OnDateSelected="rdpDay_OnDateSelected" /> </telerik:RadDatePicker>protected void Calendar_OnDayRender(object sender, Telerik.Web.UI.Calendar.DayRenderEventArgs e) { if (enableWeek == null) { if (ViewState["enableWeek"] != null) enableWeek = (StringBuilder)ViewState["enableWeek"]; } if (myBlockDays == string.Empty) { if (ViewState["myBlockDays"] != null) myBlockDays = ViewState["myBlockDays"].ToString(); } if (enableWeek != null) { string[] iEnableWeek = enableWeek.ToString().Split(','); string[] iDisableWeek = new string[7] { "0", "1", "2", "3", "4", "5", "6" }; for (int i = 0; i < iDisableWeek.Length; i++) { for (int j = 0; j < iEnableWeek.Length; j++) { if (iEnableWeek[j].Trim() == iDisableWeek[i]) { iDisableWeek[i] = ""; break; } } } for (int i = 0; i < iDisableWeek.Length; i++) { if (iDisableWeek[i] != "") { // modify the cell rendered content for the days we want to be disabled (e.g. every Saturday and Sunday) if (e.Day.Date.DayOfWeek == (DayOfWeek)Convert.ToInt32(iDisableWeek[i])) { // if you are using the skin bundled as a webresource("Default"), the Skin property returns empty string string otherMonthCssClass = "ColorGray"; // clear the default cell content (anchor tag) as we need to disable the hover effect for this cell e.Cell.Controls.Clear(); e.Cell.Text = ""; e.Cell.Enabled = false; e.Cell.CssClass = otherMonthCssClass; //set new CssClass for the disabled calendar day cells (e.g. look like other month days here) // render a span element with the processed calendar day number instead of the removed anchor -- necessary for the calendar skinning mechanism Label label = new Label(); label.Text = e.Day.Date.Day.ToString(); e.Cell.Controls.Add(label); // disable the selection for the specific day RadCalendarDay calendarDay = new RadCalendarDay(); calendarDay.Date = e.Day.Date; calendarDay.IsSelectable = false; calendarDay.ItemStyle.CssClass = otherMonthCssClass; rdpDay.Calendar.SpecialDays.Add(calendarDay); break; } } } string[] iBlockDays = myBlockDays.ToString().Split(','); for (int i = 0; i < iBlockDays.Length; i++) { if (iBlockDays[i].Trim() != "") { if (e.Day.Date == Convert.ToDateTime(iBlockDays[i].Trim())) { // if you are using the skin bundled as a webresource("Default"), the Skin property returns empty string string otherMonthCssClass = "ColorRed"; // clear the default cell content (anchor tag) as we need to disable the hover effect for this cell e.Cell.Text = ""; e.Cell.CssClass = otherMonthCssClass; //set new CssClass for the disabled calendar day cells (e.g. look like other month days here) // render a span element with the processed calendar day number instead of the removed anchor -- necessary for the calendar skinning mechanism Label label = new Label(); label.Text = e.Day.Date.Day.ToString(); e.Cell.Controls.Add(label); // disable the selection for the specific day RadCalendarDay calendarDay = new RadCalendarDay(); calendarDay.Date = e.Day.Date; calendarDay.IsSelectable = false; calendarDay.ItemStyle.CssClass = otherMonthCssClass; rdpDay.Calendar.SpecialDays.Add(calendarDay); break; } } } } }