Try OpenEdge Now
skip to main content
GUI for .NET Programming
Binding ABL Data to .NET Controls : Managing data updates : Sorting


Most .NET grid controls support sorting in response to some user action. However, the grids might differ on how the sort is accomplished. For example, the Infragistics.Win.UltraWinGrid.UltraGrid does its own sorting if the DisplayLayout:Override:HeaderClickAction property is set to SortSingle or SortMulti. You can override the UltraGrid sorting by setting this property to ExternalSortSingle or ExternalSortMulti, subscribing to the AfterSortChange event, and handling the sort there.
By contrast, the Microsoft System.Windows.Forms.DataGridView relies on its data source to handle the sorting. When this control asks the ProBindingSource to sort the data, the AutoSort property controls the ProBindingSource's response. If AutoSort is FALSE (the default), the ProBindingSource fires its SortRequest event. Your application can trap this event and handle the sort. If your application ignores the event, no sort happens. If AutoSort is TRUE, the ProBindingSource automatically reopens the query with the new sort criteria and does not fire its SortRequest event. In that case, any query that can be sorted must have been opened with the QUERY-PREPARE and QUERY-OPEN methods, rather than the OPEN QUERY statement. Otherwise, the AVM generates a run-time error.
Generally, a direct sort with an ABL query provides better performance than a control's built-in sort mechanism. This difference can be very noticeable, especially for a grid control displaying a hierarchy of tables. So for most cases, Progress Software Corporation recommends that you handle the sorting with ABL.
* Using the UltraGrid's BeforeSortChange and AfterSortChange events
* Sorting child tables for a recursive data-relation
* Using the SortRequest event