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

Sorting state 'None'

0 Answers 113 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Pankaj
Top achievements
Rank 1
Pankaj asked on 18 Nov 2011, 05:51 AM
Hi,

I want to handle the sorting state 'None' so as to sort the records in ascending order of first column. I have added following code to implement this
private void playersGrid_Sorting(object sender, GridViewSortingEventArgs e)
      {
          if (e.NewSortingState == SortingState.None)
          {
              this.playersGrid.SortDescriptors.Clear();
              SortDescriptor descriptor = new SortDescriptor();
              descriptor.Member = "Name";
              descriptor.SortDirection = System.ComponentModel.ListSortDirection.Ascending;
              //ColumnSortDescriptor csd = new ColumnSortDescriptor();
              //Telerik.Windows.Controls.GridView.ColumnSortDescriptor csd = new Telerik.Windows.Controls.GridView.ColumnSortDescriptor();
              //csd.Column = this.playersGrid.Columns[0];
              //csd.SortDirection = System.ComponentModel.ListSortDirection.Ascending;
              this.playersGrid.SortDescriptors.Add(descriptor);
          }
      }

I have tried to use sort descriptor and ColumnSortDescriptor but none of these worked for me. Please suggest how can i acomplish this behaviour.

No answers yet. Maybe you can help?

Tags
GridView
Asked by
Pankaj
Top achievements
Rank 1
Share this question
or