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

Scheduler in Agenda view - Get selected Appointment

2 Answers 101 Views
Scheduler and Reminder
This is a migrated thread and some comments may be shown as answers.
Patrick
Top achievements
Rank 1
Patrick asked on 29 Nov 2019, 12:21 PM

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 Answers, 1 is accepted

Sort by
0
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 29 Nov 2019, 01:01 PM

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.
0
Patrick
Top achievements
Rank 1
answered on 29 Nov 2019, 01:20 PM

Hi Dess,

Thanks 4 the quick response.

I am going to work with this.

Have a nice weekend.

Grtz Patrick

Tags
Scheduler and Reminder
Asked by
Patrick
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Patrick
Top achievements
Rank 1
Share this question
or