APNSoft - Web Controls, components for ASP.NET Home Help Center Contact Us
About UsProductsDownloadsPurchase
Support

DataGrid
Version 3.1



What's New
Overview
Features
Reference Book
Licensing
Support



Populating with Data
Columns   (general)
Columns   (templates)
Rows
Bottom Bar
Layout and Behavior
Exporting
Skins




 Alphabetic Filter:   A  B  C  D  E  F  G  .....   All


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 or via context menu.

In conjunction with filter feature, Grid displays special button/indicator in the bottom bar. This element (indicator) 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).

Please use the following methods and properties to add/remove row filter.
  • The RowFilter is a server-side property which specifies the filter expression.
  • The RemoveRowFilter() is a server-side method which removes the filter.
  • 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%'";



Code Samples:
Default.aspxDefault.aspx.csDefault.aspx.vbContextMenu.xml
BottomBar.xmlSkin StyleSkin ImagesNwind.mdb


  © 2003-2010 APNSoft. All rights reserved. Table of Contents   Terms of use   Contact Us   Help Center