WebGrid.AddSorter<TElement,TProperty> Method

Definition

Adds a specific sort function for a given column.

public System.Web.Helpers.WebGrid AddSorter<TElement,TProperty> (string columnName, System.Linq.Expressions.Expression<Func<TElement,TProperty>> keySelector);
member this.AddSorter : string * System.Linq.Expressions.Expression<Func<'Element, 'Property>> -> System.Web.Helpers.WebGrid
Public Function AddSorter(Of TElement, TProperty) (columnName As String, keySelector As Expression(Of Func(Of TElement, TProperty))) As WebGrid

Type Parameters

TElement

The type of elements in the grid's source.

TProperty

The column type, usually inferred from the keySelector function's return type.

Parameters

columnName
String

The column name (as used for sorting)

keySelector
Expression<Func<TElement,TProperty>>

The function used to select a key to sort by, for each element in the grid's source.

Returns

The current grid, with the new custom sorter applied.

Applies to