I set an initial sort order, but when I call this method when a field is in group by mode it seems to reset the grid, removing the group by state. What am I doing wrong?
private void DefaultSort() { UltraGridBand band = grdCompliance.DisplayLayout.Bands[0]; grdCompliance.DisplayLayout.Bands[0].SortedColumns.Clear(); //Sorting band.SortedColumns.Add(grdCompliance.DisplayLayout.Bands[0].Columns["CountrySequence"], false); band.SortedColumns.Add(grdCompliance.DisplayLayout.Bands[0].Columns["PopulationSequence"], false); band.SortedColumns.Add(grdCompliance.DisplayLayout.Bands[0].Columns["PricingDrugSequence"], false); }
Sorting and grouping are tightly linked. In order to group the the grid, you add the column to the SortedColumns collection and specify true for groupBy.
So when you clear the SortedColumns, you are clearing the grouping, as well. So you probably need to add the grouped column back into the SortedColumns collection to maintain the grouping.