We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How to clear appointments on Schedule

Hi Everywhere! I would like to know how to clear the list of events from scheduleControl, because when I click on another day of the month the events will accumulate and be repeated, for example, when I have a day 10 event, every time I click on another day the event of day 10 new is added in the Schedule, creating a retry.
Thanks in Advance!

1 Reply

MG Mohanraj Gunasekaran Syncfusion Team September 7, 2017 01:04 PM UTC

  
Hi Ary, 

Thanks for using Syncfusion product. 

By default, events are scheduled based on DateTime. We are little bit unclear about your scenario. In your scenario events(appointments) are repeated when move to next day. So, can you please confirm whether you are binding number of events in a display date alone or binding more events for more days. It can be checked by using the below code, 

Code example 
//To get the list of event in specified date. 
var events = (this.scheduleControl1.DataSource as SimpleScheduleDataProvider).GetSchedule(DateTime.Now, DateTime.Now); 
 

If you want to clear the appointments, you can use the Remove or RemoveAt method using MasterList property. Please refer to the below code example,  
Code example 
var masterlist = (this.scheduleControl1.DataSource as SimpleScheduleDataProvider).MasterList; 
//To get the list of event in specified date. 
var events = (this.scheduleControl1.DataSource as SimpleScheduleDataProvider).GetSchedule(DateTime.Now, DateTime.Now); 
 
foreach (IScheduleAppointment item in events) 
{ 
    masterlist.Remove(item); 
} 
//To update the scheduleControl. 
this.scheduleControl1.ResetProvider(this.scheduleControl1.ScheduleType); 

 

If it is possible, please provide the sample or modify the below attached sample to reproduce your scenario. It will be helpful to provide the solution at the earliest. 

Sample link: ScheduleControl 

Regards, 
Mohanraj G         
 


Loader.
Live Chat Icon For mobile
Up arrow icon