Scheduler Data Binding Tutorial
Environment
Product Version | Product | Author |
---|---|---|
2020.3.1020 | RadScheduler for WinForms | Desislava Yordanova |
Description
This tutorial will provide a full guidance for binding RadScheduler to a database from a local SQL server. It will cover the following cases:
- Binding Appointments and Resources to display the relevant events for the currently displayed resources
- Grouping by resources
- Saving the changes made in RadScheduler to the SQL server
- Creating recurring appointments and storing any exceptions to the recurrence
Solution
Follow the steps:
1. Let’s start from scratch with an empty form:
2. Drag a RadScheduler from the toolbox and drop it to the form:
3. Drag a SchedulerBindingDataSource from the toolbox and drop it onto the form:
4. Meanwhile, use the SQL scripts from the online documentation to create a Sample Database in the local SQL server that you have: Sample Database. As a result, you will have 3 empty tables:
5. Open the Smart tag for the SchedulerBindingDataSource and trigger the Data Source Configuration Wizard to generate the BindingSources for the three tables from the SQL server:
6. Now, generate the BindingSources for each of the tables in the DataSet:
7. Setup the AppointmentMappingInfo and ResourceMappingInfo in such a way to map the Appointment’s and Resource’s properties with the respective ones from the tables in the SQL server:
Setup the data binding
8. The AppointmentMappingInfo.Resources property should be set to the relation name between the Appointments and AppointmentResources table:
9. RadScheduler supports recurring appointments. When you edit an occurrence, it will create an exception event. It is necessary to create a new relation in the .xsd for the Appointment table from its ID property to the MasterEventId property and set the AppointmentMappingInfo.Exceptions field to the name of the relation:
10. The last thing we need to do is to save the changes made in RadScheduler to the server. This will be performed in RadButton.Click event handler:
Save the changes to the database
A complete solution providing a C# and VB.NET project is available here.