Quantcast
Channel: Telerik Forums RSS
Viewing all articles
Browse latest Browse all 94857

RadGridView: Changing Sort in SortChanging re-fires SortChanging

$
0
0

I found a solution.  I disabled column sorting, and used the CellClick event as follows:

 

private void radGridView1_CellClick(object sender, GridViewCellEventArgs e)
{
    if (e.Row is GridViewTableHeaderRowInfo)
    {
         Telerik.WinControls.UI.GridHeaderCellElement ghce= (Telerik.WinControls.UI.GridHeaderCellElement)sender;
 
         Telerik.WinControls.UI.GridViewTemplate gwt = (Telerik.WinControls.UI.GridViewTemplate)ghce.ViewTemplate;
 
         var ChildSort = new Telerik.WinControls.Data.SortDescriptor()
         {
             PropertyName = e.Column.Name ,
             Direction = System.ComponentModel.ListSortDirection.Ascending
         };
 
         var ChildSort2 = new Telerik.WinControls.Data.SortDescriptor()
         {
             PropertyName = "sortorder",
             Direction = System.ComponentModel.ListSortDirection.Ascending
         };
 
          gwt.SortDescriptors.Clear();
          gwt.SortDescriptors.Add(ChildSort2);
          gwt.SortDescriptors.Add(ChildSort);
     }
}

Viewing all articles
Browse latest Browse all 94857

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>