Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Expand]WinForms Controls
[Collapse]ASP.NET Controls and MVC Extensions
 [Expand]Prerequisites
 [Expand]What's Installed
 [Expand]Common Concepts
 [Collapse]ASP.NET WebForms Controls
  [Expand]Reporting
  [Expand]Chart Control
  [Expand]Grid View
  [Expand]Card View
  [Expand]Vertical Grid
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Image and Data Browsing
  [Expand]Docking and Popups
  [Expand]Site Navigation and Layout
  [Expand]File Management
  [Expand]Multi-Use Site Controls
  [Collapse]Scheduler
   [Expand]Product Information
    Getting Started
   [Expand]Fundamentals
   [Expand]Concepts
   [Expand]Visual Elements
   [Expand]Design-Time Features
   [Collapse]Examples
    [Collapse]Data Binding
      How to: Bind an ASPxScheduler to MS SQL Server Database (Step-by-Step Guide)
      How to: Bind ASPxScheduler to ObjectDataSource
      How to: Filter Appointments
      How to: Bind an ASPxScheduler to XPO via the Unit of Work
      How To: Add Resources to ASPxScheduler Bound to ObjectDataSource
    [Expand]Selection
    [Expand]Customization
    [Expand]Printing and Reporting
    [Expand]Miscellaneous
   [Expand]End-User Capabilities
   [Expand]Member Tables
  [Expand]HTML Editor
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Gauges
  [Expand]Data Editors
  [Expand]Spell Checker
  [Expand]Query Builder
 [Expand]ASP.NET MVC Extensions
 [Expand]Localization
 [Expand]Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

How to: Bind an ASPxScheduler to MS SQL Server Database (Step-by-Step Guide)

The following example demonstrates how to bind an ASPxScheduler Control to an MS SQL Server database at design time.

Expanded Steps 1-6. Create a Simple Scheduler Project.

  1. Create a new project (ASP.NET Empty Web Application).
  2. Add a Web Form and name it Default.aspx.
  3. Add a new ASP.NET folder to the project - App_Data.
  4. Switch to the Design view and drop the ASPxScheduler control from the Toolbox.

  5. In the Property Grid, specify the width and the DayView scroll height of a Scheduler control. Set the Width to 800px, set the Views->DayView->Styles->ScrollAreaHeight to 600px.

Expanded Steps 6-9. Create the Database.

  1. In the Visual Studio menu, select TOOLS->Connect to Database... The Add Connection dialog appears. Click the Change button to invoke the Change Data Source dialog. In the dialog select a Microsoft SQL Server Database File option and click OK.

  2. Select a path for the database file (the App_Data folder) and type a name (Schedule.mdf). Click OK. When you are prompted for creation of a new database, click Yes. The new database is created.

  3. Use the Server Explorer window to select the newly created database, right -click and select New Query in the context menu. This command will open a new window that enables you to execute a database query.
  4. Copy the database SQL script from the Data Table Structure for MS SQL Server Database document. Paste it into the SQL query window and execute the query. The query will create tables for Appointments and Resources within the Schedule database..

Expanded Steps 10-16. Create the Appointments Data Source.

  1. Click the smart tag of the ASPxScheduler control in Visual Studio designer to invoke a smart tag panel. In the panel, click the Appointments Data Source combo box and select the New data source... item as shown in the following picture.

  2. The Data Source Configuration Wizard window is displayed. Follow the wizard to configure the data source. Select the SQL database.

  3. Next, choose the data connection (the previously created Schedule.mdf database). This database was included in the project at the time it was created, and there are no other data connections in the project.

  4. Save connection information to the web.config file.

  5. Select all columns in the Appointments table to include into the data source.

  6. Click the Advanced button to check the box so that INSERT, UPDATE and DELETE queries will be generated automatically. Click OK to close the dialog.

  7. Click Next so that you can test the data source. Click Finish, and the Mappings Wizard for Appointments is invoked.

Expanded Steps 17-18. Specify Appointment Mappings.

  1. The window of the Mappings Wizard, entitled Setup Appointment Storage, is displayed automatically after you assign an appointment data source for the first time. You can also invoke it any time via the SchedulerControl's smart tag. To accomplish this, click the smart tag of the ASPxScheduler control in the Visual Studio designer to invoke a smart tag panel. In the panel, click the Mappings Wizard tag under the Appointments Data Source caption. The Mappings Wizard is invoked.
  2. Follow the wizard as described in the Mappings Wizards document to specify appointment mappings.

    The check box in the image above is checked by default and sets the ASPxAppointmentStorage.AutoRetrieveId property.

Expanded Steps 19-24. Create the Resources Data Source.

  1. Click the smart tag of the ASPxScheduler control in Visual Studio designer to invoke a smart tag panel. In the panel, click the Resources Data Source combo box and select the New data source... item.
  2. The Data Source Configuration Wizard window is displayed. Follow the wizard to configure the data source.
  3. First, select the SQL database as a Data Source Type.
  4. Next, choose the data connection.

  5. Select all columns in the Resources table to include in the data source.

  6. Click Next so that you can test the data source. Click Finish, and the Mappings Wizard for Resources is invoked. .

Expanded Steps 25-26. Specify Resource Mappings.

  1. The window of the Mappings Wizard, entitled Setup Resource Storage, is displayed automatically after you assign an appointment data source for the first time. You can also invoke it any time via the SchedulerControl's smart tag. To accomplish this, click the smart tag of the ASPxScheduler control in the Visual Studio designer to invoke a smart tag panel. In the panel, click the Mappings Wizard tag under the Resources Data Source caption. The Mappings Wizard is invoked.
  2. Follow the wizard as described in the Mappings Wizards document to specify resource mappings.

Expanded Step 28. Result.

  1. Run the project. The ASPxScheduler control is ready to display existing appointments. You can create, modify and delete appointments. All appointment modifications are stored in the MS SQL Server File database located in App_Data.

Expanded See Also

How would you rate this topic?​​​​​​​