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

Limit the number of days requested by the ScheduleDataProvider.GetSchedule(DateTime startDate, DateTime endDate) method

Hi,

I am writing a custom ScheduleDataProvider and my calendar items source has a limit on the number of items it returns (62 maximum items). However, upon initialization, the ScheduleControl is issuing a call to the ScheduleDataProvider.GetSchedule(DateTime startDate, DateTime endDate) passing two dates where the difference is 70 days (7/30/2017 to 10/8/2017). Is there a way to limit the number of days it asks for? I was thinking I can ask it to show the calendar for one month only in the calendar navigator but it did not work (I don't think I got it to display one calendar).

Thanks.

1 Reply

PM Piruthiviraj Malaimelraj Syncfusion Team August 22, 2017 01:45 PM UTC

Hi Truth, 

Thanks for your interest in Syncfusion products, 

We have created the simple sample as per your requirements. In order to get the notification when getting the schedules between the days, you can override the GetSchedule method of ScheduleDataProvider and check the total number schedules with number schedules between the days. Please make use of the below code, 

Code snippet: 
public override IScheduleAppointmentList GetSchedule(DateTime startDate, DateTime endDate) 
{ 
    ScheduleAppointmentList list = new ScheduleAppointmentList(); 
 
    double no_of_days = (endDate - startDate).TotalDays; 
    if (no_of_days > this.MasterList.Count) 
    { 
        if (MessageBox.Show("Enter valid dates to get the days", "", MessageBoxButtons.OK) == DialogResult.OK) 
        { 
            return list; 
        } 
    } 
   /// 
   /// 
   /// 
} 

Sample link: 

Please let us know if we misunderstood anything from your requirements. 

Regards, 
Piruthiviraj 


Loader.
Up arrow icon