We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How do I show the top-so-many or bottom-so-many records in a filter?

Platform: WinForms |
Control: GridGroupingControl |
Published Date: April 30, 2011 |
Last Revised Date: March 10, 2015

The QueryRecordMeetsFilterCriteria event has to be handled to get this behavior. A Hashtable is used to handle the values that are to be filtered at the top and bottom. The following sample displays the first 2 and last 2 records in a filter. The Hashtable is filled by using the user defined function, SetPositionFilter().

To perform a filter that restricts the filtered set to a certain number of elements, you have to filter twice. In the first pass, you get the total set of records that satisfies the filter. Then these records are numbered by using an unbound column populated indirectly with the SetPositionFilter method. Once the unbound column is populated with a position index value, you can then apply a second filter to select the first so-many or last so-many records.





Figure 1: Top and bottom 2 records value set as true on filtering first time

Figure 2: Top and bottom 2 values filtered on second time filtering applied to the same value

Sample Links




2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon