Data Access has been discontinued. Please refer to this page for more information.

How to: Use OpenAccessLinqDataSource in ASP.NET Applications

This topic will walk you through the common task of using OpenAccessLinqDataSource with Telerik Data Access model in ASP.NET Applications.

It is assumed that the following initial steps are performed:

How to Add and Configure a New OpenAccessDataSource

To add and configure a new OpenAccessDataSource to your page:

  1. Integrate the Telerik.DataAccess.Web NuGet package with the SofiaCarRentalWebApp project.
  2. Open the Default.aspx page in Source mode, and register the Telerik.OpenAccess.Web.40 assembly:

    <%@ Register Assembly="Telerik.OpenAccess.Web.40" 
                 Namespace="Telerik.OpenAccess.Web" 
                 TagPrefix="telerik" %>
    
  3. Define a new instance of OpenAccessLinqDataSource, inside the first <div> tag of the page. The ID property should be OpenAccessLinqDataSourceCategory, the ContextTypeName should be the fully qualified name of the context class, i.e. SofiaCarRental.Model.FluentModel, and the ResourceSetName property should be set to a name of an endpoint of the context (the name of an IQueryable<T> property), i.e. Categories. The control should run on the server.

    <telerik:OpenAccessLinqDataSource 
        ID="OpenAccessLinqDataSourceCategory" 
        runat="server"
        ContextTypeName="SofiaCarRental.Model.FluentModel" 
        ResourceSetName="Categories">
    </telerik:OpenAccessLinqDataSource>
    

Adding RadScriptManager

The next step is to add a RadScriptManager and register a HttpHandler. For more information how to complete this task, check out How to: Bind Data to ASP.NET Controls.

Reading and Displaying Data

The final step is to connect the OpenAccessLinqDataSource component to a data control. For example:

  1. Drag a new RadGrid control to your page.
  2. Type the name of your OpenAccessLinqDataSource control (in this case OpenAccessLinqDataSourceCategory) as a value of the DataSourceID property.

Next Steps

For additional information, you could refer to the following sections: