New to Telerik UI for WinForms? Download free 30-day trial

Codeless data binding

RELATED VIDEOS
Codeless Data Binding with RadScheduler for WinForms](http://tv.telerik.com/watch/winforms/radscheduler/codeless-data-binding-with-radscheduler-winforms)
In this video, you will learn how to use the SchedulerBindingDataSource with the RadScheduler for WinForms to quickly and codelessly data bind a RadScheduler. You will also be introduced to the RadSchedulerNavigator, a simple control that makes it easy for users navigate a RadScheduler. (Runtime: 07:04)
WinForms RadScheduler Codeless Data Binding
Introduction to RadScheduler for WinForms
In this webinar, Telerik Developer Support Specialist Robert Shoemate will introduce RadScheduler and demonstrate how to utilize its powerful feature set in your own applications. By attending this webinar, you will learn about features such as codeless data binding, adding custom fields, and UI customization. (Runtime: 55:58)
WinForms RadScheduler Tutorial

This tutorial will show you how to bind RadScheduler from the Visual Studio design time surface, by only using the RadScheduler design-time support, and without writing any code. The tutorial uses the data base which comes with the installation of Telerik UI for WinForms.

1. Open Visual Studio and start a new Windows Forms project. Open the form, created by the project.

2. Drag a RadScheduler from the toolbox to your form.

3. Drag a SchedulerBindingDataSource from the toolbox to your form.

4. Select RadScheduler and open its action list (smart tag). In it, there is a DataSource property, which is used to specify the SchedulerBindingDataSource component which will be used as a data source in RadScheduler. Select the instance of the SchedulerBindingDataSource that we just added and close the smart tag:

WinForms RadScheduler Smart Tag 

5. Open the SchedulerBindingDataSource smart tag. It shows two types of provider properties, which can be used for setting the data sources for the Appointments (EventProvider) and the Resources (ResourceProvider):

WinForms RadScheduler Smart Tag Data Source

6. Set the Appointments and the Resources data sources. To do that, in the Properties window, open the EventProvider property. Drop down the DataSource sub-property list and select Add Project DataSource... This step will display the Data Source Configuration Wizard dialog.

WinForms RadScheduler EventProvider 

7. In the "Choose a Data Source Type" page of the wizard, select the Database type and click the Next button to continue.

8. In the "Choose a Data Connection" page of the wizard, add a connection to the SchedulerData.mdf file supplied with Telerik UI for WinForms distribution.

  • Click the New Connection... button to display the Add Connection dialog.

  • Click the Change button and select the Access Database File option.

  • Set the Database File Name to the Schedulerdata.mdb file located in the Telerik UI for WinForms installation directory under \Examples\DataSources.

  • Click OK to close the Add Connection dialog.

9. Back in the "Choose a Data Connection" page of the wizard, click the Next button to continue.

10. A dialog will pop-up to ask where the file should be located. Choose No to leave the file located in the \Examples\DataSources directory.

11. In the "Save the Connection String in the Application Configuration File" click the Next button to continue.

12. In the "Choose Your Database Objects" page of the wizard, select the "Tables" checkbox to automatically select the Appointments, Resources and AppointmentsResources tables.

13. Click Finish to complete the wizard and close the dialog. This step will create a DataSet component and add it to the component tray below the form designer.

14. Then you need to edit the mappings between the objects used in RadScheduler and your data source objects. Open the SchedulerBindingDataSource ActionList and specify the DataSource for both the EventProvider and ResourceProvider to the binding source.

15. While still in the SchedulerBindingDataSource ActionList, set the DataMember properties for both the EventProvider and ResourceProvider to the respective tables.

  1. The EventProvider takes care of the data, related to the Appointments (Events) and has the following properties:

    1. Data Source, which should be a DataSet object;

    2. Data Member, which usually is bound to Appointments (Appointments is the name of the data table in the Data set)

    3. Edit Appointment Mapping (see #16 below)

  2. The ResourceProvider takes care of the data, related to Resources and has the following properties:

    1. Data Source, which should be a DataSet object;

    2. Data Member which usually is bound to Resources (Resources is the name of the data table in the Data set)

    3. Edit Resource Mapping (see #17 below)

In our case we should set the DataMember properties for both the EventProvider and ResourceProvider to Appointments and Resources respectively:

WinForms RadScheduler SchedulerBindingDataSource 

16. While still in the SchedulerBindingDataSource ActionList, click on the Edit Appointment Mapping link.

WinForms RadScheduler Mapping 

This will invoke the Appointment Mapping Dialog which provides you with an easy and intuitive UI for mapping Appointment properties with DataSource properties. Map all of the properties with their respective counterpart, whereas:

  1. UniqueID is the ID of your appointments

  2. Resources is a relation in the dataset, in this case AppointmentsAppointmentsResources

  3. Exceptions is a self-relation in the dataset, in this case AppointmentsAppointments.

At the end the Appointment Mapping Dialog should look like the following screen shot. Save and Close the dialog when done:

WinForms RadScheduler Appointment Mapping Dialog  

17. By using the SchedulerBindingDataSource ActionList, click on the Edit Resource Mapping link to edit the ResourceMappingInfo:

WinForms RadScheduler Edit Resource Mapping

18. Select the ID and ResourceName for the respective properties and close the dialog:

WinForms RadScheduler Resource Mapping Dialog

19. Fill the data tables in the data set:

Fill Data

AppointmentsTableAdapter appointmentsAdapter = new AppointmentsTableAdapter();
appointmentsAdapter.Fill(this.schedulerDataDataSet.Appointments);
ResourcesTableAdapter resourcesAdapter = new ResourcesTableAdapter();
resourcesAdapter.Fill(this.schedulerDataDataSet.Resources);
AppointmentsResourcesTableAdapter appointmentsResourcesAdapter = new AppointmentsResourcesTableAdapter();
appointmentsResourcesAdapter.Fill(this.schedulerDataDataSet.AppointmentsResources);

Dim appointmentsAdapter As New AppointmentsTableAdapter()
appointmentsAdapter.Fill(Me.SchedulerDataDataSet.Appointments)
Dim resourcesAdapter As New ResourcesTableAdapter()
resourcesAdapter.Fill(Me.SchedulerDataDataSet.Resources)
Dim appointmentsResourcesAdapter As New AppointmentsResourcesTableAdapter()
appointmentsResourcesAdapter.Fill(Me.SchedulerDataDataSet.AppointmentsResources)

20. Use the Rebind method of the SchedulerBindingDataSource object if the dataset is filled after applying the event provider data source:

Rebind the Binding Source

schedulerBindingDataSource1.Rebind();

SchedulerBindingDataSource1.Rebind()

21. Run the project.

See Also

In this article