This is a migrated thread and some comments may be shown as answers.

RadCalendar load so slow

1 Answer 100 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Duong
Top achievements
Rank 1
Duong asked on 17 Nov 2012, 04:35 AM
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>

1 Answer, 1 is accepted

Sort by
0
Angel Petrov
Telerik team
answered on 21 Nov 2012, 03:00 PM
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.
Tags
Calendar
Asked by
Duong
Top achievements
Rank 1
Answers by
Angel Petrov
Telerik team
Share this question
or