Displaying appointments

3 posts, 1 answers
  1. Radoslaw
    Radoslaw avatar
    40 posts
    Member since:
    Sep 2007

    Posted 13 Nov 2009 Link to this post

    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. Answer
    Peter
    Admin
    Peter avatar
    6637 posts

    Posted 16 Nov 2009 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Radoslaw
    Radoslaw avatar
    40 posts
    Member since:
    Sep 2007

    Posted 18 Nov 2009 Link to this post

    Thank You very much!!
Back to Top