I have a Silverlight app with a telerik:RadGridView.
Depending on the query the users selects I want to sort a certain column. Only 1 column at a time.
In my code behind, I do the below. This works the first time, but when the other option is select and sort 2 is set, both columns are set to be sorted.
How do I only sort on one column at a time?
ColumnSortDescriptor csd = new ColumnSortDescriptor();
if (Mycheckbox.IsChecked == true)
{
csd.Column = MyGrid.Columns["Column1"];
csd.SortDirection = System.ComponentModel.ListSortDirection.Descending;
}
else
{
csd.Column = MyGrid.Columns["Column2"];
csd.SortDirection = System.ComponentModel.ListSortDirection.Descending;
}
MyGrid.SortDescriptors.Add(csd);