RadCalendar load so slow

2 posts, 0 answers
  1. Duong
    Duong avatar
    1 posts
    Member since:
    Sep 2012

    Posted 16 Nov 2012 Link to this post

    I have used RadCalendar to display specify dates. Appointment is a object with propertes : StartTime and EndTime
    In codebehind, i used event DayRender to display dates between StartTime and EndTime each of appointment.
    With only some appointment, RadCalendar still load so slow.
    Sorry my bad english.
    Here my code:
    ascx.vb
           
    Protected Sub RadCalendar1_DayRender(ByVal sender As Object, ByVal e As DayRenderEventArgs) Handles RadCalendar1.DayRender
          
                Dim Specificdate As DateTime = e.Day.Date
                Dim flag = False
                Dim lst As List(Of AIAppointmentInfo) = ctlAIAppointment.GetByUserId(UserInfo.UserID)
                For Each obj As AIAppointmentInfo In lst
                    If flag = False Then
                        If Specificdate >= obj.StartTime And Specificdate <= obj.EndTime Then
                            e.Cell.CssClass = "SpecificDay"
                            flag = True
                        ElseIf Specificdate.Day = obj.StartTime.Day And Specificdate.Month = obj.StartTime.Month And Specificdate.Year = obj.StartTime.Year Then
                            e.Cell.CssClass = "SpecificDay"
                            flag = True
                        End If
                    End If
     
                Next
     End Sub
    ascx
    <telerik:RadCalendar runat="server" ID="RadCalendar1" Skin="Hay" AutoPostBack="False"
                        EnableMultiSelect="false" DayNameFormat="FirstTwoLetters" EnableNavigation="true"
                        EnableMonthYearFastNavigation="false" IsTodayHighlighted="true"
                       >
        <SpecialDays>
        <telerik:RadCalendarDay Repeatable="Today" Date="" ItemStyle-CssClass="rcToday" />
        </SpecialDays>
    </telerik:RadCalendar>
  2. Angel Petrov
    Admin
    Angel Petrov avatar
    1006 posts

    Posted 21 Nov 2012 Link to this post

    Hello Duong,

    You should not experience poor performance in your case. Could you ensure that the delay is due to the CSS classes being applied? In the code you have provided I see two different operations:
    1. Extracting data
    2. Iterating through the data items
    If you have a large number of data this could cause the delay in your case. I have created a simple project in which I change the styles of the calendar and I did not experience any performance problems (you could find the demo in the attachments). Please elaborate more on the way you extract the data and the size of the collection.

    Kind regards,
    Angel Petrov
    the Telerik team
    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 their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top