Most of the web controls that support databinding (like Telerik RadGrid) provide automatic read, insert, update, and delete functionality when used with an OpenAccessDataSource control. You can easily configure HTML elements on the design surface of these controls and data-bind them to the OpenAccessDataSource control.
Binding Web Server Controls with an OpenAccessDataSource
The web controls that support databinding (like Telerik RadGrid) are very similar in their design. Bind one of these Web server controls to the OpenAccessDataSource control using the following steps:
- Create an ASP.NET Web application.
- Define the Data Model (project enhanced by Telerik OpenAccess ORM tool that contains persistent classes) to the project, configure the project to use the Telerik OpenAccess ORM tool (add a reference to a project or assembly that contains persistent classes), , and rebuild the project. For more information, see How to: Use the Reverse Mapping Wizard or How to: Use the Forward Mapping Wizard.
- Drag the control onto the Web page design surface.
- Configure the OpenAccessDataSource . For more information, see Configuring the OpenAccessDataSource Control.
- Configure the control to use the OpenAccessDataSource control.
The following procedure creates a RadGrid control that is bound to an OpenAccessDataSource control. To complete this procedure, you must have already configured the Telerik OpenAccess ORM tool and defined the persistent classes for the Northwind database inside a project. For more information, see How to: Use the Reverse Mapping Wizard or How to: Use the Forward Mapping Wizard.
To create a RadGrid control that is bound to an OpenAccessDataSource:
- Build the web project and the data model (included in a separate project).
- Drag an instance of the RadGrid control onto the design surface.
- Click the > symbol on the RadGrid control and select Choose Data Source.
- Select <New Data Source> from the drop-down list.
- When the Data Source Configuration wizard appears, select OpenAccess data source and specify SalesOrdersDataSource as the name of the data source, and then click OK.
- Select from available object scope providers one that will provide the data and then click Next.
- Select Order extent from the drop-down list box, and check the automatic insert, update, and delete check boxes.
- Click Finish.
This creates a new RadGrid control instance that is bound to an OpenAccessDataSource control instance named SalesOrdersDataSource .
- Check the Enable Editing, Inserting, Deleting, and Paging check boxes under the General Features title in the RadGrid Tasks box.
- Click OK.
- Rebuild the project and run the application.