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
  [Expand]Scheduler
  [Expand]HTML Editor
  [Collapse]Pivot Grid
   [Collapse]Getting Started
     Lesson 1 - Bind a Pivot Grid to an MDB Database
     Lesson 2 - Bind a Pivot Grid to an OLAP Cube
     Tutorial Videos
     Included Components
   [Expand]Fundamentals
   [Expand]Binding to Data
   [Expand]Data Shaping
   [Expand]Data Analysis
   [Expand]Data Formatting
   [Expand]Layout
   [Expand]Appearance
   [Expand]Data Export
   [Expand]Design-Time Features
   [Expand]UI Elements
   [Expand]Examples
   [Expand]End-User Capabilities
   [Expand]Member Tables
  [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]ASP.NET Core 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]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Lesson 1 - Bind a Pivot Grid to an MDB Database

This tutorial shows how to add an ASPxPivotGrid to a new ASP.NET application, bind it to a database and create pivot grid fields mapped to appropriate fields from the database. In this example, a Northwind.mdb database is used to supply the ASPxPivotGrid with data.

Expanded Steps 1-6. Create a New Project and Add ASPxPivotGrid to it

  1. Run MS Visual Studio.

  2. Create a new project by selecting File | New | Project… In the invoked New Project dialog, select the Web section, and choose the DevExpress v17.2 Template Gallery.

  3. In the DevExpress Template Gallery, go to the ASP.NET WEBFORMS category and select Empty Web Application.

  4. In the DevExpress ASP.NET MVC Project Wizard, select Empty on the Choose Layout page.

    Click Create Project.

  5. Right-click the project in the Solution Explorer and select Add | Web Form from the context menu. In the invoked dialog, leave the default item name and click OK.

  6. Drag and drop the ASPxPivotGrid control from the DX.17.2: Data & Analytics toolbox tab onto the page.

Expanded Steps 7-13. Prepare a Data Source

  1. Right-click the App_Data folder and select Add | Existing Item... from the context menu. In the Add Existing Item dialog, locate the Northwind database file and click Add. You can find the database by the following path.

    C:\Users\Public\Documents\DevExpress Demos 17.2\Components\Data\nwind.mdb

  2. Click the smart tag icon displayed in the top-right corner of the pivot grid to invoke the ASPxPivotGrid Tasks popup window.

    In this window, open the Choose Data Source drop-down list and select New data source...

    This will run the Data Source Configuration wizard.

  3. On the first page, choose Database as the data source type and click OK.

  4. On the next page, select the nwind.mdb database from the list and click Next.

  5. On the next page, leave default settings and click Next.

  6. On the Configure the Select Statement page, choose the database columns that you need to include in the data source. To do this, follow the steps below.

    1. Select Specify columns from a table or view.
    2. Select SalesPerson from the Name drop-down list.
    3. Check the following columns:
      • Country
      • ProductName
      • CategoryName
      • Extended Price
      • Sales Person

    Click Next.

  7. On the last page, you can optionally test the automatically generated query using the Test Query button.

    To close the wizard, click Finish.

Expanded Steps 14-15. Create and Arrange Pivot Grid Fields

  1. Click the smart tag icon and then click Designer.... This will invoke the ASPxPivotGrid Designer.

    Click the Retrieve fields button, ensure that the Check All option is enabled, and then click OK to automatically create pivot grid fields for all data source columns.

    The PivotGridControl will locate all the created fields in the Data Header Area.

  2. Use drag-and-drop to move the fields between areas. Also, you can move the fields between the areas by using the Property pane and specifying their index within the areas (use the Area and AreaIndex properties).

    Put the CategoryName and ProductName fields (in the given order) into the Row Header Area, the Country and Sales_Person fields into the Column Header Area, and the Extended_Price field into the Data Header Area.

Expanded Result

  1. Run the project to see the result.

Expanded See Also

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