Click PostBack to see the state of the grid is preserved.
The example demonstrates the filtering capabilities of r.a.d.
grid. Filtering can be enabled/disabled using
RadGrid.AllowFilteringByColumn or
GridTableView.AllowFilteringByColumn properties. Then each
column that supports filtering (GridBoundColumn, GridCheckBoxColumn, etc) shows
a filter box beneath the corresponding header.
User can set a filter expression based on the rules specified in the corresponding column properties:
FilterFormatString, CurrentFilterFunction, CurrentFilterValue .
After pressing the filter button (next to the filter box) the grid displays only the records matching
the filter criteria (regarding the settings of all filter boxes).
Additionally, if you set
AutoPostBackOnFilter property of the corresponding column to
true
you can trigger postback filter operation for
Contains (for string types) and
EqualTo (for numeric types)
when you type in the filter box and press
[Enter]
from the keyboard. Moreover, you can execute other type of filter action by setting the
CurrentFilterFunction property of the corresponding column to an internally recognized value, for example:
<
radG:GridBoundColumn DataField="ProductName" HeaderText="ProductName"
SortExpression="ProductName" UniqueName="ProductName"
CurrentFilterFunction="StartsWith" AutoPostBackOnFilter="true"
>
The filtering menu of r.a.d.
grid is presented by single object server-side. This way of implementation has been chosen to speed up the grid performance by merely creating one menu instance server side and cloning the instance for different columns.
The filtering menu is independent for each column in RadGrid - this means that the filtering menu options vary by the
DataType of the corresponding column. Hence integer column will have one set of filter menu options (EqualTo, NotEqualTo, GreaterThan, LessThan, etc.), string column will have additional options (Contains, StartsWith. etc.) and so on.
Note that the built-in filtering feature is not supported with simple data-binding
(calling DataBind()). See the
Simple data binding demo from the
Populating with
data section for more info about the limitations of this binding mode.
Further information about grid known filter functions and filter list options you can find in these articles from the grid documentation:
Filter list options
Grid known filter functions
Filtering chapter
Additionally, totals are displayed in the Quantity column footer (the sum is calculated
in the ItemDataBound handler in the code-behind). Further information about how to display
totals in the grid footers you can find in this section from the grid documentation:
Totals in grid footers