Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Objective Grid for Microsoft .NET User's Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

3.6 Sorting a Grid

Objective Grid for Microsoft .NET allows you to sort a grid by either columns or rows. This section demonstrates how to enable sorting. See also (Section 3.7.4, "Sorting," for information on how you can customize Objective Grid for Microsoft .NET to enable other sorting-related features.)


The Sort_CS tutorial, which is located in the Tutorials subdirectory of your Objective Grid for Microsoft .NET installation directory, shows how to support sorting when users double-click row or column headers.

Replace the FormLoad() method with the following code:

  1. Build and run the application.

    Figure 26: Grid With Random Integers

  2. In the Form Designer, click the grid and view the grid properties.

  3. Locate the EnableHorizontalSorting and EnableVerticalSorting properties in the Data property group. Set these properties to true.

  4. Build and run the application.

  5. Double-click the column header labeled "A." The rows are sorted in ascending order based on each row's value in column "A." Figure 27 shows the result.

    Figure 27: Sorted Column

  6. Double-click the column header again to resort the values in descending order.

You can programmatically control whether or not the rows or columns can be sorted. Assuming the grid object is called gridControl1:

This code fragments allows rows to be sorted and disallows sorting for columns.



Previous fileTop of DocumentContentsNo linkNext file

Copyright © Rogue Wave Software, Inc. All Rights Reserved.

The Rogue Wave name and logo, and Stingray, are registered trademarks of Rogue Wave Software. All other trademarks are the property of their respective owners.
Provide feedback to Rogue Wave about its documentation.