I have a radcalendar that works fine until I add MultiViewRows="3". Then the OnDayRender event does not fire on page load. OnDayRender fires if go forward or back, just not the first time it loads. If I change it to MultiViewRows="1" it works fine. How do I get it working the first time it loads with MultiViewRows="3"? I am using Telerik version 2013.3.1015.35.
This is my control:
This is my OnDayRender function:
This is my control:
<telerik:RadCalendar ID="cldDates" runat="server" AutoPostBack="true" OnDayRender="rCalander_Render" ShowRowHeaders="false" ShowOtherMonthsDays="false" MultiViewRows="3" Skin="Simple"> </telerik:RadCalendar>
This is my OnDayRender function:
List<DateTime> enddates = new List<DateTime>(); List<DateTime> StartDates = new List<DateTime>(); public void rCalander_Render(object sender, Telerik.Web.UI.Calendar.DayRenderEventArgs e) { var bookingdates2 = from d in DbContext.ihh_Bookings where d.lngHouseID == HouseID && d.dtmEndDate >= new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1) && (d.lngBookingStatusID != 7 && d.lngBookingStatusID != 1 && d.lngBookingStatusID != 10) select d; foreach (ihh_Booking w in bookingdates2) { //var bookingdates = from d in DbContext.ihh_HouseBookings_Webs where d.HouseID == HouseID select d; //foreach (ihh_HouseBookings_Web w in bookingdates) //{ if (e.Day.Date == w.dtmStartDate) { StartDates.Add(w.dtmStartDate.Value); } if (e.Day.Date >= w.dtmStartDate && e.Day.Date <= w.dtmEndDate) { e.Day.IsSelectable = false; e.Cell.BackColor = System.Drawing.Color.Red; e.Cell.ToolTip = "Booked"; cldDates.SpecialDays.Add(e.Day); } if (e.Day.Date == w.dtmEndDate) { e.Day.IsSelectable = false; e.Cell.BackColor = System.Drawing.Color.FromArgb(Convert.ToInt32("1EA7D8", 16)); e.Cell.ToolTip = "Check Out"; cldDates.SpecialDays.Add(e.Day); enddates.Add(w.dtmEndDate.Value); } } foreach (DateTime t in StartDates) { if (enddates.Contains(t) && e.Day.Date == t) { e.Day.IsSelectable = false; e.Cell.BackColor = System.Drawing.Color.Purple; e.Cell.ToolTip = "Check out/In"; cldDates.SpecialDays.Add(e.Day); } } DateTime dtStartDate = (cldDates.CalendarView as Telerik.Web.UI.Calendar.View.MonthView).MonthStartDate; DateTime dtEndDate = (cldDates.CalendarView as Telerik.Web.UI.Calendar.View.MonthView).MonthEndDate; if ((e.Day.Date < dtStartDate || e.Day.Date > dtEndDate)) { // e.Cell.Visible = false; e.Cell.BackColor = System.Drawing.Color.White; } }