Home Forums WinForms controls Xceed Grid for WinForms Secondary Sub-sort Reply To: Secondary Sub-sort

User (Old forums)
Member
Post count: 23064

You can add a regular sort on each column you want once the user sorts one of the columns. For example, once the user sorts “division”, in the event handler, add a sort on “position” and then on “last name”.

e.g.:
<i>
private void Form1_Load(object sender, System.EventArgs e)
{
gridControl1.Columns[ “division” ].SortDirectionChanged += new EventHandler(division_SortDirectionChanged);
}

private void division_SortDirectionChanged(object sender, EventArgs e)
{
gridControl1.Columns[ “position” ].SortDirection = SortDirection.Ascending;
gridControl1.Columns[ “last name” ].SortDirection = SortDirection.Ascending;
}
</i>

Imported from legacy forums. Posted by André (had 3361 views)