New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

Declarative Data Binding

Declarative data source controls, which were introduced in ASP.NET 2.0, let you access and modify the scheduler's data with minimal amount of code. Binding RadScheduler to such a data source can be completed without writing any code: you need only configure the data source and set a few properties to link the scheduler to the data source and indicate which fields the scheduler is to use.


The example below shows how to bind RadScheduler to a SqlDataSource component at design time, and demonstrates how to set up user-defined resources:

Setting up the data source

  1. Drag a SqlDataSource component from the toolbox onto your page.SqlDataSource

  2. The Smart Tag for the SQLDataSource component should automatically come up.If it does not, right click on the SqlDataSource component and choose Show Smart Tag. On the Smart Tag, choose Configure Data Source...

  3. The Configure Data Source Wizard appears.

  4. Choose a database and a connection that your application will use to connect to that database.Choose data connection

  5. Click Next to continue. Save the connection string, and choose Next again.connection string

  6. Configure the SELECT statement. Check the columns for the appointment information and click the "Advanced..." button. Select the first option to auto-generate statements for INSERT, UPDATE, DELETE and SELECTconfigure select

  7. Click Next, test the Query, and finish the data source configuration byclicking the Finish button:test query

Setting up the Scheduler

  1. Drag a RadScheduler control onto your page. The Smart Tag should automatically come up. If it does not, right click on the RadScheduler control and choose Show Smart Tag. On the Smart Tag, choose Configure Data Source...
    Smart Tag

  2. Select your SQLDataSource as the data source, and specify the fields for the key, start time, end time, subject, recurrence storage, and recurrence parent key as shown below. Then click OK.SQL Config Wizard

  3. Add another SQLDataSource to your page and configure it to select ID and UserName from the Users table. The names of these fields should be different form the fields of the RadScheduler. You only need a SELECT statement for this data source.

  4. Select the RadScheduler in the designer, and click the ellipsis button on the ResourceTypes property in the property pane.Resource Types

  5. In the Resource Type Collection Editor, add a new resource type and configure it to bind to the second SQLDataSource:Users Resource

The ForeignKeyField, KeyField and TextField properties must be set.

You have now bound the RadScheduler to a data source. Run the application and note that the Users custom resourceis available in the edit form.

For another example of declarative data binding, using an Object data source instead of a SQL data source, see Getting Started.

See Also

In this article