Back to Devexpress

GridViewCustomBindingGetDataHandler Delegate

aspnetmvc-devexpress-dot-web-dot-mvc-acfc0818.md

latest2.2 KB
Original Source

GridViewCustomBindingGetDataHandler Delegate

A delegate method that enables you to populate the grid view model with data rows requested by the grid, when implementing custom data binding of the GridView.

Namespace : DevExpress.Web.Mvc

Assembly : DevExpress.Web.Mvc5.v25.2.dll

NuGet Package : DevExpress.Web.Mvc5

Declaration

csharp
public delegate void GridViewCustomBindingGetDataHandler(
    GridViewCustomBindingGetDataArgs e
);
vb
Public Delegate Sub GridViewCustomBindingGetDataHandler(
    e As GridViewCustomBindingGetDataArgs
)

Parameters

NameTypeDescription
eGridViewCustomBindingGetDataArgs

An GridViewCustomBindingGetDataArgs object that contains the related arguments.

|

Remarks

razor
public static void MyGetData(GridViewCustomBindingGetDataArgs 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 
      .ApplySorting(e.State.SortedColumns) //Your function that sorts your model 
      .Skip(e.StartDataRowIndex) //Position on the first required data row 
      .Take(e.DataRowCount); //Get the number of currently requested data rows (rows of the current page or visible rows of the processed group) 
}

Refer to Implementation of Typed Method Delegates to learn more.

See Also

DevExpress.Web.Mvc Namespace