WebGrid.AddSorter<TElement, TProperty> Method
Adds a specific sort function for a given column.
Namespace: System.Web.Helpers
Assembly: System.Web.Helpers (in System.Web.Helpers.dll)
Syntax
'Declaration
Public Function AddSorter(Of TElement, TProperty) ( _
columnName As String, _
keySelector As Expression(Of Func(Of TElement, TProperty)) _
) As WebGrid
'Usage
Dim instance As WebGrid
Dim columnName As String
Dim keySelector As Expression(Of Func(Of TElement, TProperty))
Dim returnValue As WebGrid
returnValue = instance.AddSorter(columnName, _
keySelector)
public WebGrid AddSorter<TElement, TProperty>(
string columnName,
Expression<Func<TElement, TProperty>> keySelector
)
public:
generic<typename TElement, typename TProperty>
WebGrid^ AddSorter(
String^ columnName,
Expression<Func<TElement, TProperty>^>^ keySelector
)
member AddSorter :
columnName:string *
keySelector:Expression<Func<'TElement, 'TProperty>> -> WebGrid
JScript does not support generic types and methods.
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
Type: System.String
The column name (as used for sorting)
- keySelector
Type: System.Linq.Expressions.Expression<Func<TElement, TProperty>>
The function used to select a key to sort by, for each element in the grid's source.
Return Value
Type: System.Web.Helpers.WebGrid
The current grid, with the new custom sorter applied.