Show theme settings Shopping cart Download trialFree Trial
Change Theme Settings
Change Theme Settings
Themes
 
Show All Themes
v
...v

Custom Data Binding (Advanced)

Operation:  
Time taken:   ms
x
Drag a column header here to group by that column
From Not filtered
Subject Not filtered
Sent Not filtered
Size Not filtered
Attachment? Not filtered
xv
x
+
-
xv
Bert ParkinsEmail Attachments. Is it possible to add multiple attachments? I haven't found a way to do this.4/3/20165874
Tom HamlettPayables Due Calculator is ready for testing.3/8/201646749
Tom HamlettEmail Attachments. Is it possible to add multiple attachments? I haven't found a way to do this.2/26/2016184383
Ray ShipmanIntegrating Developer Express MasterView control into an Accounting System.2/21/2016205415
Tom HamlettEmail System. What library are we going to use?3/31/2016258211
Dave MurrelMain Menu: Add a File menu. File menu item is missing.3/12/2016276977
Ryan FischerReceivables Calculator. Where can I find the complete specs?3/5/2016214367
Carl LucasPayables Due Calculator is ready for testing.2/28/2016193712
Brad BarnesReceivables Calculator. Where can I find the complete specs?3/9/2016144899
Carl LucasDrag & Drop operations are not available in the scheduler module.4/6/2016232127
 Count=300,000 Sum=45359070276 
Page 1 of 30000 (300000 items)Prev1234567299982999930000Next
Show filter builder dialogCreate Filter 


DevExpress ASP.NET Grid View supports custom data binding that allows you to perform all data operations, such as paging, sorting, filtering, grouping and summary calculation, completely by yourself.

In this mode, you handle data operations in corresponding Action methods; the correspondence is defined by populating the grid's CustomBindingRouteValuesCollection.

In each specified Action, the processed operation related state information, such as a column state (i.e., which column is sorted and in which direction) or a pager state (which page is selected), is passed automatically. The grid's current state (view model) can be obtained via the static GridViewExtension.GetViewModel method and can be updated with the processed operation state. Then, the required data should be provided for the grid view model via a call to its ProcessCustomBinding method.

The ProcessCustomBinding method has several overloads. You can select a particular one depending on which data operations you need to handle.

Generally, this method provides the following parameters representing typed method delegates:

getDataRowCountMethod of the GridViewCustomBindingGetDataRowCountHandler type
Provide implementation for this method to return the total number of data rows.

getDataMethod of the GridViewCustomBindingGetDataHandler type
Provide implementation for this method to return the required data rows to the grid.

getSummaryValuesMethod of the GridViewCustomBindingGetSummaryValuesHandler type
Provide implementation for this method to calculate and return values of summaries required within the grid.

getGroupingInfoMethod of the GridViewCustomBindingGetGroupingInfoHandler type
Provide implementation for this method to return data rows for visible and expanded groups in the required order that depends on the applied grouping and sorting.

getUniqueHeaderFilterValuesMethod of the GridViewCustomBindingGetUniqueHeaderFilterValuesHandler type
Provide implementation for this method to return unique values to be displayed in the header filter popup list invoked for a column.

The resulting grid state (view model) is returned as a model to a view that contains GridView. To bind GridView to this view model, use the BindToCustomData method.

This demo shows an advanced implementation of custom data binding - all data operations are processed (in particular: sorting, paging, grouping, summary calculations and filtering including column header filter invocation).

Note that when implementing the grid's custom data binding, the DevExpressEditorsBinder must be used instead of the default model binder to correctly transfer values from DevExpress editors back to the corresponding data model fields. In this demo, the DevExpressEditorsBinder is assigned to the ModelBinders.Binders.DefaultBinder property within the Global.asax file, thus overriding the default model binder.

Collapse/Expand
Local Copy of this Demo
To inspect the source code for this demo on your machine, you must first install our components via the DevExpress Component Installer.
You can open a local copy of this online demo directly from this webpage (if using v20.2.8, 21.1.4 or higher).
Open CS Solution
The source code files for this demo are installed (by default) in the following directory:
\Users\Public\Documents\DevExpress Demos XX.X\Components\ASP.NET\CS\MVCxGridViewDemos