[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
   Getting Started
  [Expand]Grid View
  [Expand]Tree List
  [Expand]Card View
  [Expand]Reporting
  [Expand]Chart Control
  [Expand]Pivot Grid
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Scheduler
  [Expand]Site Navigation and Layout
  [Expand]HTML Editor
  [Expand]Gauges
  [Expand]Vertical Grid
  [Expand]Data Editors
  [Expand]Docking and Popups
  [Expand]File Management
  [Expand]Data and Image Navigation
  [Expand]Multi-Use Site Controls
  [Expand]Spell Checker
  [Collapse]Query Builder
   [Collapse]Getting Started
     Lesson 1 - Add a Query Builder to a Web Application
     Lesson 2 - Use the Resulting Query
    Binding to Data
    Selecting Tables
    Joining Tables
   [Expand]Shaping Data
    Previewing Results
    Obtaining the Resulting Query
    Localizing the 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]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Lesson 1 - Add a Query Builder to a Web Application

This lesson will teach you how to add a Query Builder to an ASP.NET Web Forms application.

To get started with this tutorial, create a new ASP.NET Web Forms application containing one Web Form. To add a Query Builder to the created web application, do the following.

  1. Select the default Web Form in the Solution Explorer and click the Design button to open the visual designer for this Web Form.

  2. Expand the DX.18.1: Data and Analytics Toolbox group and drop the ASPxQueryBuilder control onto the page.

  3. Next, provide the Query Builder with a data connection required to automatically obtain database schema information and properly generate data provider-specific SQL. To achieve this, add an XPO connection string for your database to the application's Web.config file.

    Pass the name of the added connection string to the Query Builder's ASPxQueryBuilder.OpenConnection method on the Page_Load event as shown in the code sample below.

  4. In the application's Web.config file, add the "resources" section as shown below.

    Alternatively, to avoid automatic loading of any libraries by a control (e.g., when such libraries are already referenced on the web page), declare an empty "resources" section and manually attach DevExtreme resources and the required third-party libraries (such as jQuery and Globalize) to the web page.

    Deleting the DevExpress "resources" section from the Web.config file will enable the default behavior (with automatic loading only of DevExtreme, without adding third-party libraries).

    To learn more about this configuration, see Embedding Third-Party Libraries.

  5. Run your web application to view the result. Use drag-and-drop to add a data table from the tables list to the current query.

    Enable check boxes for data rows that you want to include into the query.

    Click the Preview Results () toolbar command to preview the results of the query execution.

Expanded See Also

Is this topic helpful?​​​​​​​