This is a migrated thread and some comments may be shown as answers.

Force sorting of colums

2 Answers 111 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Heiko
Top achievements
Rank 1
Iron
Veteran
Heiko asked on 11 Dec 2014, 11:08 AM
We have a grid with its ItemsSource bound to a QCV (and an EF query as source). There has to be a sorted column so that Paging works properly. However, I can also completely remove a sort which means paging is no longer working. How can I prevent the user from "un-sorting" a column? What I would like to have is instead of a threestate sorting (asc, desc, unsorted) only a twostate sorting (asc, desc). Any idea?

Regards
Neils

2 Answers, 1 is accepted

Sort by
0
Accepted
Dimitrina
Telerik team
answered on 12 Dec 2014, 10:01 AM
Hi Neils,

As to your second question, you can modify the way sorting is applied Ascending or Descending with a code similar to: 
void clubsGrid_Sorting(object sender, Telerik.Windows.Controls.GridViewSortingEventArgs e)
{
    if (e.NewSortingState == Telerik.Windows.Controls.SortingState.None)
    {
        if (e.OldSortingState == Telerik.Windows.Controls.SortingState.Ascending)
            e.NewSortingState = Telerik.Windows.Controls.SortingState.Descending;
        else
            e.NewSortingState = Telerik.Windows.Controls.SortingState.Ascending;
    }
}

I hope this helps.

Regards,
Dimitrina
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Heiko
Top achievements
Rank 1
Iron
Veteran
answered on 14 Dec 2014, 05:00 PM
Hi Dimitrina,

not only is 42 THE ANSWER, but this one also. :-)

Thanks a lot!

Regards
Neils
Tags
GridView
Asked by
Heiko
Top achievements
Rank 1
Iron
Veteran
Answers by
Dimitrina
Telerik team
Heiko
Top achievements
Rank 1
Iron
Veteran
Share this question
or