Back to Devexpress

Lesson 2 - Bind a Pivot Grid to an OLAP Data Source

aspnetmvc-115624-components-pivot-grid-getting-started-lesson-2-bind-a-pivot-grid-to-an-olap-data-source.md

latest2.1 KB
Original Source

Lesson 2 - Bind a Pivot Grid to an OLAP Data Source

  • Dec 17, 2020
  • 3 minutes to read

This topic describes how to connect the PivotGrid extension to an OLAP data source - an Analysis Services server or a local cube file.

To bind the PivotGrid to an OLAP data source, follow the steps below.

Step 1. Create an ASP.NET MVC Application

  1. To learn how to create an ASP.NET MVC Application, see steps 1-6 from Lesson 1 - Bind MVCxPivotGrid to Microsoft SQL Server Database File.

Step 2-3. Add the PivotGrid Extension to the MVC Application

  1. Add the PivotGrid extension to your project using the Insert DevExpress MVC Extension Wizard. For this, open a required View file ( Views | Home | Index.cshtml in this topic), right-click the desired location to display the menu, and click Insert DevExpress MVC Extension…

  2. In the invoked dialog, go to the Data tab, select PivotGrid and click Insert. The wizard automatically generates the View code for the extension and inserts it into the View at the cursor position.

Step 4. Create a Connection String

  1. In the project, create the Helpers folder, right-click it and add a new PivotGridOLAPHelper.cs helper class that will provide access to the connection string.

Step 5-6. Change the View Code

  1. In the pivot grid’s generated View code (Views | Home | _PivotGridPartial.cshtml), use the PivotGridExtension.BindToOLAP method with the specified OLAP connection string from the PivotGridOLAPHelper class. This enables binding to an OLAP data source. After that, add and configure pivot grid fields.

  2. Run the project. As a result, you have a fully functional MVC PivotGrid bound to an OLAP cube.