Hello Srinivas,
Thank you for clarifying your requirements.
You can use the
Visibility property of the appointment to display only appointments that belong to the selected resource. The delete and update operations should work normally without any additional code. To insert appointments correctly, you need to handle the
Appointment.CollectionChanging event to listen for new appointments and set their
ResourceId. The following code snippet demonstrates this:
public partial class Form1 : Form
{
Color[] colors = new Color[]{Color.LightBlue, Color.LightGreen, Color.LightYellow,
Color.Red, Color.Orange, Color.Pink, Color.Purple, Color.Peru, Color.PowderBlue};
string[] names = new string[]{"Alan Smith", "Anne Dodsworth",
"Boyan Mastoni", "Richard Duncan", "Maria Shnaider"};
public Form1()
{
InitializeComponent();
for (int i = 0; i < names.Length; i++)
{
Resource resource = new Resource();
resource.Id = new EventId(i);
resource.Name = names[i];
resource.Color = colors[i];
this.radScheduler1.Resources.Add(resource);
}
this.radDropDownList1.DataSource = this.radScheduler1.Resources;
this.radDropDownList1.DisplayMember = "Name";
this.radDropDownList1.ValueMember = "Id";
this.radDropDownList1.SelectedIndexChanged += new Telerik.WinControls.UI.Data.PositionChangedEventHandler(radDropDownList1_SelectedIndexChanged);
this.radScheduler1.Appointments.CollectionChanging += new Telerik.WinControls.Data.NotifyCollectionChangingEventHandler(Appointments_CollectionChanging);
}
void Appointments_CollectionChanging(object sender, Telerik.WinControls.Data.NotifyCollectionChangingEventArgs e)
{
if (e.Action == Telerik.WinControls.Data.NotifyCollectionChangedAction.Add && e.NewItems != null)
{
foreach (Appointment app in e.NewItems)
{
app.ResourceId = this.radDropDownList1.SelectedValue as EventId;
}
}
UpdateAppointmentVisibility();
}
void radDropDownList1_SelectedIndexChanged(object sender, Telerik.WinControls.UI.Data.PositionChangedEventArgs e)
{
UpdateAppointmentVisibility();
}
private void UpdateAppointmentVisibility()
{
foreach (Appointment app in this.radScheduler1.Appointments)
{
if (app.ResourceId == this.radDropDownList1.SelectedValue)
{
app.Visible = true;
}
else
{
app.Visible = false;
}
}
}
}
As to our response times, trial support tickets and forums are answered within 72 hours and support tickets of the licensed users are answered in 24 or 48 hours, depending on the license. This does not necessarily mean that you will have to wait 72 hours to get a response but in this might happen when we have tickets or tasks with higher priority.
I hope this will help you. Do not hesitate to write back if you need further assistance.
Kind regards,
Ivan Todorov
the Telerik team