Scheduler in Agenda view - Get selected Appointment

3 posts, 1 answers
  1. Patrick
    Patrick avatar
    43 posts
    Member since:
    Aug 2018

    Posted 29 Nov 2019 Link to this post

    Hello,

    Is there a simple way to get the selected appointment in agenda view?

    Or is there a way to convert a AgendaAppointmentWrapper to an Appointment?

    Grtz and thnxs

    Patrick Vossen

  2. Answer
    Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3988 posts

    Posted 29 Nov 2019 Link to this post

    Hello, Patrick,

    Note that Agenda view in RadScheduler internally uses a RadGridView. If you need to detect the selected events, you need to actually get the selected rows. Each cell contains the respective information from the associated Appointment:
                SchedulerAgendaViewElement agendaViewElement = this.radScheduler1.SchedulerElement.ViewElement as SchedulerAgendaViewElement;
                RadGridView agendaGrid = agendaViewElement.Grid;
                foreach (GridViewRowInfo selectedRow in agendaGrid.SelectedRows)
                {
                    foreach (GridViewCellInfo cell in selectedRow.Cells)
                    {
                        Console.WriteLine(cell.ColumnInfo.Name + " " + cell.Value);
                    }
                }

    The AgendaAppointmentWrapper has an internal property that stores the Appointment object. Hence, you don't have public access to it. You can use reflection to get it:  

                SchedulerAgendaViewElement agendaViewElement = this.radScheduler1.SchedulerElement.ViewElement as SchedulerAgendaViewElement;
                RadGridView agendaGrid = agendaViewElement.Grid;
                foreach (GridViewRowInfo selectedRow in agendaGrid.SelectedRows)
                {
                    AgendaAppointmentWrapper wrapper = selectedRow.DataBoundItem as AgendaAppointmentWrapper;
                    FieldInfo fi = typeof(AppointmentWrapper).GetField("appointment", BindingFlags.NonPublic | BindingFlags.Instance);
                    Appointment appointment = fi.GetValue(wrapper) as Appointment;
                }

    I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

    Regards,
    Dess | Tech Support Engineer, Sr.
    Progress Telerik

    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  3. Patrick
    Patrick avatar
    43 posts
    Member since:
    Aug 2018

    Posted 29 Nov 2019 in reply to Dess | Tech Support Engineer, Sr. Link to this post

    Hi Dess,

    Thanks 4 the quick response.

    I am going to work with this.

    Have a nice weekend.

    Grtz Patrick

Back to Top