RadScheduler for ASP.NET AJAX

RadControls for ASP.NET AJAX

RadScheduler has a DataSource property that lets you bind it to any object that implements the IListSource or IEnumerable interface. Thus, you can bind the scheduler directly to a DataTable or DataView (IListSource), or to various List objects (IEnumerable). When using the DataSource property to bind the scheduler, you must also implement the code for inserting, updating, and deleting appointments using the RadScheduler server-side events.

Example

The following example demonstrates binding to a generic list of objects, which represents appointment information, including a custom resource for room. It implements AppointmentInsert, AppointmentUpdate, and AppointmentDelete event handlers to allow the scheduler to insert, update, and delete appointments.

  1. Drag a RadScheduler control from the toolbox onto your page.

  2. Move to the code-behind page for your web page, and add two lines to the using section (C#) or Imports section (VB).

     

  3. In the definition of the class for your Web page, add two class definitions, one to hold information about appointments, and another to hold information about the custom resource (rooms):

     

  4. Add two private properties to the class for your Web page whose values are the current list of appointments and the list of rooms. The appointments list needs to persist, so we save that one in the session state:

     

  5. Add the FindById helper function to the class for your Web page:

     

  6. In the Page_Load event handler, add code to initialize the RadScheduler so that it can read the appointment information, define the custom resource type for rooms, and set the DataSource property to bind the scheduler to the data.

     

  7. Return to the designer for Default.aspx and select the RadScheduler control.

  8. In the properties pane, double-click on the AppointmentInsert event and add the following event handler:

     

  9. Double-click on the AppointmentUpdate event and add the following event handler:

     

  10. Double-click on the AppointmentDelete event and add the following event handler:

     

You have now bound your scheduler using the DataSource property. Run the application and note the custom resource is available in the edit form.

See Also