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

"Lazy" Databinding

Hello,

I'm binding the Schedule control throught database. But I have many records, so I decided to populate the control with current month records.

But, how I could intercept month change and, re-populate the control with new data? I'm intercepting throught of event StartDateChanged, but how this event occurs in async fashion, I cannot refresh whole schedule.

Have you another approach for this?

Best Regards


3 Replies

SS Selvavinayagam S Syncfusion Team March 19, 2009 09:01 AM UTC

Hi Israel,

Thank you for using Syncfusion products.

Syncfusion Schedule control do not provide builtin support to handle the database query before fetching the data from database. So we need to create dynamic query to meet your requirement.

Here we are creating dynamic select command based on the ScheduleType and StartDate properties.
Following code snippet select the appointment from the datasource based on the schedule start date and schedule view type.

[c#]

if (this.Schedule1.ScheduleType == ScheduleViewType.Day)
this.AppointmentDataSource.SelectCommand = "SELECT * FROM [AppointmentsTable] WHERE [StartTime] BETWEEN#" + Schedule1.StartDate + "#" + "AND#" + Schedule1.StartDate.AddDays(1) + "# ";

if (this.Schedule1.ScheduleType == ScheduleViewType.Week)
this.AppointmentDataSource.SelectCommand = "SELECT * FROM [AppointmentsTable] WHERE [StartTime] BETWEEN#" + Schedule1.StartDate + "#" + "AND#" + Schedule1.StartDate.AddDays(7) + "# ";

if (this.Schedule1.ScheduleType == ScheduleViewType.WorkWeek)
this.AppointmentDataSource.SelectCommand = "SELECT * FROM [AppointmentsTable] WHERE [StartTime] BETWEEN#" + Schedule1.StartDate + "#" + "AND#" + Schedule1.StartDate.AddDays(5) + "# ";


Please refer the sample in the following link which illustrate the above.

http://www.syncfusion.com/support/user/uploads/Sample_f0f3793a.zip

Please let us know if this helps.

Regards,
Selva



IA Israel Aece March 24, 2009 04:02 PM UTC

Hello Selva,

Thanks for your reply.

This approach worked. But my problem is that user is clicking in "<" and ">" buttons, navigating day by day.

In case, when user change for previous month or next month, the schedule is empty, because it was filled it with current month data.

Best Regards,




SS Selvavinayagam S Syncfusion Team March 25, 2009 01:42 PM UTC

Hi Israel,

Thank you for using Syncfusion products.

Please refer the sample in the following link, which demonstrate how to retrieve the data from Database based on the Schedule visible Days.

http://www.syncfusion.com/support/user/uploads/DataBindingSample_b61ff777.zip

In this sample, we just calculate the Visible days, through the event CheckVisibleDays. And create the select command based on the visible days.

Please let us know if this helps.

Regards,
Selva


Loader.
Live Chat Icon For mobile
Up arrow icon