private
void
gridView_Sorting(
object
sender, GridViewSortingEventArgs e)
{
try
{
if
(schedules ==
null
)
{
e.Cancel =
true
;
return
;
}
if
(e.OldSortingState == SortingState.Ascending)
{
e.NewSortingState = SortingState.Descending;
schedules = schedules.OrderByDescending(s => s.Role).ThenBy(s => s.Name).ToList();
}
else
if
(e.OldSortingState == SortingState.Descending)
{
schedules = schedules.OrderByDescending(s => s.Name).ToList();
e.NewSortingState = SortingState.None;
}
else
{
e.NewSortingState = SortingState.Ascending;
schedules = schedules.OrderBy(s => s.Role).ThenBy(s => s.Name).ToList();
}
this
.radDataPager.Source = schedules;
//e.DataControl.ItemsSource = this.radDataPager.Source; // replaced by the next line which is the same thing.
this
.gridView.ItemsSource =
this
.radDataPager.Source;
this
.gridView.Items.Refresh();
this
.radDataPager.PageIndex = 0;
e.Cancel =
true
;
}
catch
(Exception ex)
{
txtStatus.Text =
"Erorr in gridView_Sorting:"
+ex.Message;
}
}
It shows sorted items on the current page but it does not navigate to another page.
Can you provide small sample code that works?
Thanks.