aspnetmvc-18056-components-pivot-grid-binding-to-data-database-server-mode.md
The MVC PivotGrid extension supports a specific binding mode designed to work with large datasets. Within this binding mode, data-aware operations (for instance, filtering, grouping and aggregation) are performed on the database server side, hence, this mode is called database server mode.
In database server mode, the MVC PivotGrid is bound to a queryable source using the PivotGridExtension.BindToLINQ method, which allows the PivotGrid to load data from the queryable source on demand.
When an end-user performs data operations (filtering, grouping, etc.), the PivotGrid generates smart queries to receive only those records that must be displayed on screen. These requests are passed to the associated queryable source. The queryable source translates these requests into the required queries and executes them. This ensures quick response and improved performance for large data sources.
For end-users, the MVC PivotGrid functions identically in regular and server modes.
Perform the following steps to bind the PivotGrid to a data source in database server mode.
Add the PivotGrid to your project
Change the View code
In server mode, the pivot grid does not have simultaneous access to bound data in its entirety, and this imposes some limitations on the pivot grid’s features. See the list below for information on features that are not supported in server mode.
Besides the limitations above, the pivot grid extension has an export limitation. The PivotGridExtension class does not provide special methods for exporting if the Server Mode data source is used. The following example demonstrates how to use the default ExportTo… methods to export data by creating a ServerModeDataSource object in code.
return PivotGridExtension.ExportToXls(GetPivotSettings(),
new DevExpress.PivotGrid.ServerMode.ServerModeDataSource(
new DevExpress.PivotGrid.ServerMode.Queryable.QueryableQueryExecutor(
new MPG_ServerMode.Models.ContosoRetailDWEntities().V_CustomerOrders)));
Note
Note that in server mode, the pivot grid is bound to data in read-only mode.