Infragistics(R) NetAdvantage(R) Windows Forms
SortIndicator Enumeration
Example  See Also  E-mail your feedback on this topic.
Infragistics.Win.UltraWinGrid Namespace : SortIndicator Enumeration

Used to specify the method that should be used to sort the column.

Syntax

Visual Basic (Declaration) 
Public Enum SortIndicator 
   Inherits System.Enum
C# 
public enum SortIndicator : System.Enum 

Members

MemberDescription
Ascending Ascending. The column should be sorted in ascending order.
Descending Descending. The column should be sorted in descending order.
Disabled Disabled. Sorting should be disabled for the column.
None None. The column should not be sorted.

Example

Following code shows how to programmatically sort rows. SortIndicator property returns the current state of sorting on the column. If the column is sorted, then it returns either Ascending or Descending depending on how the column is sorted. It returns None if the column is not sorted. It can also return Disabled if the property was set to that value previously. You can also set the property to change it's sort status. For example, you can set the property to Ascending and Descending to sort row by the column. You can set it to None to clear sorting. You can set it to Disabled to prevent the user from sorting by that column.

Visual BasicCopy Code
Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid

  Private Sub Button22_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button22.Click

      Dim band As UltraGridBand = Me.ultraGrid1.DisplayLayout.Bands(0)

      ' Sort the rows by Country and City fields. Notice the order in which these columns 
      ' are set. We want to sort by Country and then sort by City and in order to do that
      ' we have to set the SortIndicator property in the right order.
      band.Columns("Country").SortIndicator = SortIndicator.Ascending
      band.Columns("City").SortIndicator = SortIndicator.Ascending

	' To sort multi-column using SortedColumns property
	' This enables multi-column sorting
	this.ultraGrid1.DisplayLayout.Override.HeaderClickAction = Infragistics.Win.UltraWinGrid.HeaderClickAction.SortMulti
	
	' It is good practice to clear the sorted columns collection
      band.SortedColumns.Clear()

      ' You can sort (as well as group rows by) columns by using SortedColumns 
      ' property off the band
      band.SortedColumns.Add("ContactName", False, False)

  End Sub
C#Copy Code
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;

private void button22_Click(object sender, System.EventArgs e)
{

	UltraGridBand band = this.ultraGrid1.DisplayLayout.Bands[0];

	// Sort the rows by Country and City fields. Notice the order in which these columns 
	// are set. We want to sort by Country and then sort by City and in order to do that
	// we have to set the SortIndicator property in the right order.
	band.Columns["Country"].SortIndicator = SortIndicator.Ascending;
	band.Columns["City"].SortIndicator    = SortIndicator.Ascending;

	// To sort multi-column using SortedColumns property
	// This enables multi-column sorting
	this.ultraGrid1.DisplayLayout.Override.HeaderClickAction = Infragistics.Win.UltraWinGrid.HeaderClickAction.SortMulti;
	
	// It is good practice to clear the sorted columns collection
      and.SortedColumns.Clear();

	// You can sort (as well as group rows by) columns by using SortedColumns 
	// property off the band
	band.SortedColumns.Add( "ContactName", false, false );

}

Remarks

The SortIndicator enum is used for specifying the Column's UltraGridColumn.SortIndicator property. To allow the user to sort the columns set the UltraGridOverride.HeaderClickAction property of the Override object to SortSingle or SortMulti. This will allow the user to sort rows by a column by clicking on the column's header. To sort the rows by one or more columns in code, add the columns to the Band's UltraGridBand.SortedColumns collection.

See Also