Force sorting of colums

3 posts, 1 answers
  1. Heiko
    Heiko avatar
    153 posts
    Member since:
    Oct 2012

    Posted 11 Dec 2014 Link to this post

    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. Answer
    Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 12 Dec 2014 Link to this post

    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.

     
  3. Heiko
    Heiko avatar
    153 posts
    Member since:
    Oct 2012

    Posted 14 Dec 2014 in reply to Dimitrina Link to this post

    Hi Dimitrina,

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

    Thanks a lot!

    Regards
    Neils
Back to Top