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

Displaying appointments

2 Answers 74 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Radoslaw
Top achievements
Rank 1
Radoslaw asked on 13 Nov 2009, 12:23 PM

Hi!

Scheduler Version 2008.2.1001.35

The problem is best described in the attached file. The file shows part of the week view, week by week. I have Scheduler that is bound to generic list. I cant find why my appointments are not displying always in the same manner.

2 Answers, 1 is accepted

Sort by
0
Accepted
Peter
Telerik team
answered on 16 Nov 2009, 03:14 PM
Hi Radoslaw,

If you want to sort the appointments by any criteria (start time, subject, etc..) you should use the AppointmentComparer property of RadScheduler. For example, the following code sorts appointments by subject:

using Telerik.Web.UI;
  
public partial class _Default : System.Web.UI.Page
{
  
  
    class CustomAppointmentComparer : IComparer<Appointment>
    {
        public int System.Collections.Generic.IComparer<Telerik.Web.UI.Appointment>.Compare(Appointment first, Appointment second)
        {
            if (first == null || second == null) {
                throw new InvalidOperationException("Can't compare null object(s).");
            }
  
            if (first.Start < second.Start) {
                return -1;
            }
  
            if (first.Start > second.Start) {
                return 1;
            }
  
            if (first.End > second.End) {
                return -1;
            }
  
            return String.Compare(first.Subject, second.Subject);
  
            return 0;
        }
  
    }
  
    protected void  Page_Load(object sender, System.EventArgs e)
    {
  
    }
    protected void  Page_Init(object sender, System.EventArgs e)
    {
        RadScheduler1.AppointmentComparer = new CustomAppointmentComparer();
    }
  
  
}


Greetings,
Peter
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Radoslaw
Top achievements
Rank 1
answered on 18 Nov 2009, 07:37 AM
Thank You very much!!
Tags
Scheduler
Asked by
Radoslaw
Top achievements
Rank 1
Answers by
Peter
Telerik team
Radoslaw
Top achievements
Rank 1
Share this question
or