Hi!
In my code I'm creating new appointments in a scheduler by dropping them from a radGridView. Any ideas how can I get the last created appointment element of the scheduler, or the appointment element assigned to the newly created appointment?
private void svc_PreviewDragDrop(object sender, RadDropEventArgs e)
{
SchedulerCellElement schedulerCell = e.HitTarget as SchedulerCellElement;
if (schedulerCell != null)
{
GridDataRowElement draggedRow = e.DragInstance as GridDataRowElement;
if (draggedRow != null)
{
if (draggedRow.Data.DataBoundItem != null)
{
if (draggedRow.GridControl.DataSource != null)
{
MainJobObject draggedMainJobObject = (MainJobObject)draggedRow.Data.DataBoundItem;
AppointmentWithObject appointment = new AppointmentWithObject(schedulerCell.Date, schedulerCell.Date.AddHours(1), draggedMainJobObject.Customer, " / ", draggedMainJobObject.MachineType);
appointment.Start = schedulerCell.Date;
appointment.End = schedulerCell.Date.AddHours(1);
appointment.AssignedMainJobObject = draggedMainJobObject;
appointment.ResourceId = schedulerCell.View.GetResourceId();
scheduler.Appointments.Add(appointment);
//CustomAppointmentElement appointmentElement = get the appointment element that was just created;
//if (appointmentElement != null)
//{
// appointmentElement.ChangeStatus(2);
//}
}
}
}
}
}