RadScheduler for WinForms is highly customizable component that offers functionality similar to that of the Calendar included with MS Outlook. When working with RadScheduler, developers can easily bind data sources directly to it using an instance of SchedulerBindingDataSource. The provided data source can be in the form of a database or business objects. The only requirement is that the data source must conform to a specific structure and provide specific fields. Today, I will explain how to set up basic data binding in RadScheduler using SchedulerBindingDataSource and an Access database.
For this entry, it should be noted that the base application I will be starting with consists of a RadScheduler, RadSchedulerNavigator, and RadButton.
Figure 1. The Base Application
When performing data binding with RadScheduler, the provided data source must conform to a specific layout. This layout is comprised of the following tables.
Figure 2. Appointments Table
This is the table in which appointments will be stored. Note that only ID, Summary, Start, and End are required fields.
Figure 3. Resources Table
This is the table in which resources will be stored.
Figure 4. AppointmentsResources Table
This is the table that allows for a many-to-many relationship between appointments and resources.
Please note that it is possible to customize these tables and display additional fields in RadScheduler. You can read more about this feature here.
Included with the installation of RadControls for WinForms are a few sample databases to help get you started with this model. These are located in the '\Examples\DataSources' folder. Their file names are SchedulerData.mdb for MS Access, and SchedulerData.mdf + SchedulerData_log.ldf for SQL Server. I will be using a modified version of SchedulerData.mdb for this example.
SchedulerBindingDataSource is the component we will be using to bind data to the RadScheduler. To use it in your application, simply drag an instance of it from the ToolBox into the form designer. Once available, adding a data source is quite simple:
Figure 5. Data Source Configuration Wizard
Once the previous steps are completed, a new DataSet and BindingSource will be generated for use with the SchedulerBindingDataSource. The SchedulerBindingDataSource must then be configured to bind to the new BindingSource via its Smart Tag.
Figure 6. SchedulerBindingDataSource Setup
Once the instance of SchedulerBindingDataSource has been correctly bound, the appointment mapping and resource mappings can be setup through its Smart Tag as well.
Figure 7. Edit Appointment Mapping
Figure 8. Edit Resource Mapping
Now that the SchedulerBindingDataSource has been configured, you can bind it to an instance of RadScheduler by simply setting the RadScheduler's DataSource to the SchedulerBindingDataSource via its Smart Tag.
Now that the the RadScheduler has been configured to receive data from our correctly configured SchedulerBindingDataSource, we need to make sure to populate our data source with data.
The following code can be used to populate the DataSet.
Now that we can see appointments from the database in RadScheduler, we also need to make sure that the user can easily commit new appointments back to the database. This can be done through the following.
Click here to download the code used in this entry...
Subscribe to be the first to get our expert-written articles and tutorials for developers!