MultiViewRows>1 stops OnDayRender working on page load

3 posts, 0 answers
  1. Michael
    Michael avatar
    2 posts
    Member since:
    Oct 2013

    Posted 21 Oct 2013 Link to this post

    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:

    <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;
     
                }
    
            }
  2. Eyup
    Admin
    Eyup avatar
    3015 posts

    Posted 24 Oct 2013 Link to this post

    Hi Michael,

    I have prepared a sample web site using the reported RadControls version to test the described behavior. On my side the event is triggered on initial page load as expected. Can you please run the attached application and let us know if it works correctly from your end, too?

    Regards,
    Eyup
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Michael
    Michael avatar
    2 posts
    Member since:
    Oct 2013

    Posted 24 Oct 2013 Link to this post

    Yes it works from my end and solves my problem. Thanks for your help.
Back to Top