DataGrid
Controls Suite 4.5 |
| Overview |
| Features |
| Reference Book |
| Live Demos |
| | Populating with Data |
| | Columns |
| | Rows |
| | Appearance & Layout |
| | Behavior |
| | Bottom Bar |
| | Application scenarios |
| | | Master/Detail Grids |
| | | CheckBoxes |
| | | DropDowns |
| | | Images |
| | | Update Panel |
|
|
|
APNSoft DataGrid includes the filter feature which allows users to quickly locate records they are looking for. Row filter can be applied from the server side or client side (JavaScript procedure, context menu, input box, etc.). This example demonstrates how you can filter records by using the bar for alphabetic filtering.
In conjunction with filter feature, Grid displays special button/indicator in the bottom bar. This element is useful to reflect the current filter state. It also can be used to switch ON/OFF applied row filter. For instance, when a row filter is applied, the filter indicator is marked as active. Likewise, when the filter is removed, the indicator is disabled (inactive).
You can use the following methods and properties to add/remove row filter.
- The RowFilter is a server-side property which specifies the filter expression.
- The dg.SetRowFilter(GridID,Filter) is a client-side method which sets the filter.
- The dg.RemoveRowFilter(GridID) is a client-side method which removes the filter.
- The dg.GetRowFilter(GridID) is a client-side method which returns the filter.
- The dg.AddRowFilter(GridID,Filter) is a client-side method which adds a filter expression to the current Grid's filter expression.
Row Filter is a string expression that specifies how rows are to be filtered. For complete info about filter expressions, refer to the MSDN Library (the DataColumn.Expression property).
Below are examples of the most popular filter expressions (C#):
dg1.RowFilter = "CustomerID = 'ANTON'";
dg1.RowFilter = "CustomerID Like 'A%'";
dg1.RowFilter = "Date = #12/31/2008#";
dg1.RowFilter = "Date < #1/1/2008#";
dg1.RowFilter = "City <> 'Tokyo' AND City <> 'Paris'";
dg1.RowFilter = "Age < 16 OR Age > 65 ";
To apply a filter which is switched off by default, use the "minus" sign at the first position:
dg1.RowFilter = "-CustomerID Like 'A%'";
|