Version

AfterSortChange Event

Occurs after a sort action is completed.
Syntax
'Declaration
 
Public Event AfterSortChange As BandEventHandler
public event BandEventHandler AfterSortChange
Event Data

The event handler receives an argument of type BandEventArgs containing data related to this event. The following BandEventArgs properties provide information specific to this event.

PropertyDescription
Band The associated band (read-only).
Remarks

The bandargument returns a reference to an UltraGridBand object that can be used to set properties of, and invoke methods on, the band that was sorted. You can use this reference to access any of the returned band's properties or methods.

The UltraWinGrid can automatically sort the contents of columns without the addition of any code, provided the control is able to preload the rows in the band. Preloading is enabled by default if the recordset bound to the band contains less than 1000 rows. If you do not want to preload rows, but you still want to provide column sorting in the control, you must implement column sorting yourself using the BeforeSortChange and AfterSortChange events.

The BeforeSortChange event, which occurs before a sort action is completed, is generated before this event.

Example
Following code shows some of the information available in AfterSortChange event.

For an overview of how to handle events in Visual Basic or Visual C#, see Event Handlers in Visual Basic and Visual C#. For specific information and code examples illustrating how to consume events in your application, see Consuming Events in the .NET Framework Developer's Guide.

Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid
Imports System.Diagnostics

   Private Sub UltraGrid1_AfterSortChange(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.BandEventArgs) Handles ultraGrid1.AfterSortChange

       ' AfterSortChange gets fired after the user sorts rows or groups rows
       ' by a column. It also gets fired when the user changes the sort direction
       ' of an already sorted column.

       ' Following code prints out columns in the sorted columns collection.
       Debug.WriteLine("AfterSortChange: ")
       Dim i As Integer
       For i = 0 To e.Band.SortedColumns.Count - 1
           Dim sortColumn As UltraGridColumn = e.Band.SortedColumns(i)

           If sortColumn.IsGroupByColumn Then
               Debug.WriteLine("     Grouped by " & sortColumn.Key & " sorted " & sortColumn.SortIndicator.ToString())
           Else
               Debug.WriteLine("     " & sortColumn.Key & " sorted " & sortColumn.SortIndicator.ToString())
           End If
       Next

   End Sub
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;

private void ultraGrid1_AfterSortChange(object sender, Infragistics.Win.UltraWinGrid.BandEventArgs e)
{

	// AfterSortChange gets fired after the user sorts rows or groups rows
	// by a column. It also gets fired when the user changes the sort direction
	// of an already sorted column.

	// Following code prints out columns in the sorted columns collection.
	Debug.WriteLine( "AfterSortChange: " );
	for ( int i = 0; i < e.Band.SortedColumns.Count; i++ )
	{
		UltraGridColumn sortColumn = e.Band.SortedColumns[i];

		if ( sortColumn.IsGroupByColumn )
			Debug.WriteLine( "     Grouped by " + sortColumn.Key + " sorted " + sortColumn.SortIndicator.ToString( ) );
		else
			Debug.WriteLine( "     " + sortColumn.Key + " sorted " + sortColumn.SortIndicator.ToString( ) );
	}

}
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also