Can't Sort Days Order of Appoinments in Monthview

2 posts, 0 answers
  1. Karl
    Karl avatar
    226 posts
    Member since:
    Jun 2005

    Posted 22 Dec 2012 Link to this post


    I use RadScheduler in my project and my appointments have custom colors, icons etc.
    I add appointments to RadScheduler manually in the following way:
    foreach (var app in appointments)

    I have a problem with RadScheduler MonthView. I want to add appointments to MonthView and I want them to be shown sorted by time (IEvent.Start.TimeOfDay), so if app1.Start.TimeOfDay > app2.Start.TimeOfDay and app1.Start.Date == app2.Start.Date then app1 should appear under app2.

    I tried to solve this problem by ordering my appointments collection:
    var appointments = src.OrderBy(a => a.Start.TimeOfDay);
    foreach (var app in appointments)

    But this did not help, so is there a way to solve this problem? Actually I need a way for sorting appointments by time in MonthView.

    I am sending you an image of the MonthView, where you can see that appointments are ordered in an inccorrect way. Take a look at Dec 20 and you will see the appointment, that appears at the bottom has its Start.TimeOfDay 09:15, so it should appear as the second starting from the top. Why does it behave in such a strange way?

    Thank you for your support.

  2. Julian Benkov
    Julian Benkov avatar
    1135 posts

    Posted 26 Dec 2012 Link to this post

    Hello Karl,

    Thank you for writing.

    I have tested the described approach and I did not find any issues with the order of the added appointments. The RadShceduler control always sorts the appointments using the start DateTime. Here is a used test application:
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;
    using Telerik.WinControls.UI;
    namespace Lab.Scheduler
        public partial class SchedulerSortAppointmentsForm : Form
            private RadScheduler scheduler = new RadScheduler();
            public SchedulerSortAppointmentsForm()
                scheduler.Dock = DockStyle.Fill;
                scheduler.Parent = this;
                scheduler.ActiveViewType = SchedulerViewType.Month;
            protected override void OnLoad(EventArgs e)
                Appointment apt = new Appointment(DateTime.Now.AddHours(1), new TimeSpan(1, 0, 0), "Appointment 2");
                apt = new Appointment(DateTime.Now, new TimeSpan(1, 0, 0), "Appointment 1");
                apt = new Appointment(DateTime.Now.AddMinutes(70), new TimeSpan(1, 0, 0), "Appointment 3");

    Please view the result in the attached screenshot. If you continue to experience the same issue please send us a small part of your data and sample project to investigate the case locally.

    Thank you for your time and cooperation.

    All the best,
    Julian Benkov
    the Telerik team
    Q3’12 of RadControls for WinForms is available for download (see what's new). Get it today.
Back to Top