This question is locked. New answers and comments are not allowed.
Hi,
We allow our users to sort a Gridview by 3 columns max. When the user selects another Gridview we're saving the sort-columns and order of the active Gridview. When the user reselects a previous Gridview we want to restore the sort-columns. This works fine if the Gridview is only sorted by 1 column. But when the user sorted the previous Gridview by multiple columns, only the SortingState of the last sort-column is visible to the user.
FYI. The query, sorting and paging is done using a webservice which performs the requested query on the database. The result page data is returned and bound to the ItemsSource. The Gridview sorting is performed by requerying the database using an event handler on the Gridview.Sorting.
Could you instruct us how we can make all SortingState visible to the user during the Gridview initialization, see source code below
?
Regards, Remco
We allow our users to sort a Gridview by 3 columns max. When the user selects another Gridview we're saving the sort-columns and order of the active Gridview. When the user reselects a previous Gridview we want to restore the sort-columns. This works fine if the Gridview is only sorted by 1 column. But when the user sorted the previous Gridview by multiple columns, only the SortingState of the last sort-column is visible to the user.
FYI. The query, sorting and paging is done using a webservice which performs the requested query on the database. The result page data is returned and bound to the ItemsSource. The Gridview sorting is performed by requerying the database using an event handler on the Gridview.Sorting.
Could you instruct us how we can make all SortingState visible to the user during the Gridview initialization, see source code below
?
Regards, Remco
this
.ListView.ItemsSource = queryResult;
for
(
int
i = 0; i <= 2; i++)
{
if
(!
string
.IsNullOrEmpty(sortColumnName[i]))
{
Telerik.Windows.Data.SortDescriptor descriptor =
new
Telerik.Windows.Data.SortDescriptor();
descriptor.Member = sortColumnName[i];
descriptor.SortDirection = sortColumnOrder[i] ==
"ASC"
? System.ComponentModel.ListSortDirection.Ascending : System.ComponentModel.ListSortDirection.Descending;
this
.ListView.SortDescriptors.Add(descriptor);
GridViewColumn columnSort =
this
.ListView.Columns[sortColumnName[i]];
columnSort.SortingState = sortColumnOrder[i] ==
"ASC"
? SortingState.Ascending : SortingState.Descending;
}
}