Implementation of Typed Method Delegates

A call to a grid view model's GridViewModel.ProcessCustomBinding method in a Controller delegates the implementation of a grid view model population to Model-layer functions specified via the method's typed parameters. In general, the ProcessCustomBinding method can accept five parameters that point to method delegates of specific types. This topic describes the available delegate types and provides you with information on how they can be implemented.

You can refer to the following demos to see how two binding scenarios (simple and advanced) are implemented using different method delegates.

Gets an object containing information about the current state on the GridView.

When implementing this delegate, obtain the total number of rows in your model and assign it to the GridViewCustomBindingGetDataRowCountArgs.DataRowCount property. The GridView requires this information to properly calculate the number of grid pages to be displayed within the pager.

Gets or sets a list of currently requested model characteristics (depending upon which delegated method is being implemented, it can be a list of data rows, or a list of grouping information objects, or a list of calculated summary values).

Gets a list of objects containing information about the group rows (in particular, the field name identifying the corresponding grouped column, the group value - key, and the number of data rows within the group - count).

Gets or sets a list of currently requested model characteristics (depending upon which delegated method is being implemented, it can be a list of data rows, or a list of grouping information objects, or a list of calculated summary values).

Gets a list of objects containing information about the group rows (in particular, the field name identifying the corresponding grouped column, the group value - key, and the number of data rows within the group - count).

GridViewCustomBindingGetGroupingInfoHandler

Method implementation is optional. It is required if you use grouping within the grid.

Provide implementation for this method to return grouping information for group rows (the group value - key, and the number of data rows within the group - count) related to the grouped column. And also take into account the applied filtering (if any).

Gets a list of objects containing information about the group rows (in particular, the field name identifying the corresponding grouped column, the group value - key, and the number of data rows within the group - count).

Filter your model based on the applied grouping by using e.GroupInfoList.

Group your model based on values of the processed column using the e.FieldName.

Sort your model in the required order using e.SortOrder.

Form a list that contains grouping information (the group value - key, and the number of data rows within the group - count) on group rows.

Return the created list to e.Data.

In a general case, the implementation will look as follows.

C#

publicstaticvoid MyGetGroupingInfo(GridViewCustomBindingGetGroupingInfoArgs e) {
e.Data = Model
.ApplyFilter(e.State.FilterExpression) //Your function that filters your model
.ApplyGroupFilter(e.GroupInfoList) //Your function that filters your model so that it contains rows meeting the applied grouping
.GroupBy(e.FieldName) //Your function that groups your model based on values of the processed column
.OrderBy(e.SortOrder)) //Your function that sorts your model in the required direction
.GetGroupInfo(e.FieldName, e.SortOrder); //Your function that returns grouping information for group rows (the group value - key, and the number of data rows within the group - count) related to the processed group operation
}

GridViewCustomBindingGetUniqueHeaderFilterValuesHandler

Method implementation is optional. It is required if you display header filter buttons to use filtering within the grid.

Provide implementation for this method to return unique values to be displayed in the header filter dropdown list invoked for a column.