ViewModel.cs:
public QueryableDataServiceCollectionView<MyTable> MyTableView { get; set; }
var dsq = context.MyTable.AddQueryOption("$orderby", "InsertDateTime");
MyTableView = new QueryableDataServiceCollectionView<MyTable>(dsq.Context, dsq)
{
PageSize = 25,
AutoLoad = true
};
View.xaml:
<telerik:RadGridView ItemsSource="{Binding ElementName=MyPager, Path=PagedSource}">
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn Header="Insert Date Time"
DataMemberBinding="{Binding InsertDateTime}" />
</telerik:RadGridView.Columns>
</telerik:RadGridView>
<telerik:RadDataPager x:Name="MyPager"
PageSize="25"
Source="{Binding MyTableView}" />
When I click on the Insert Date Time column header, a Microsoft.OData.Client.DataServiceQueryException exception is thrown with the message "Duplicate property named 'insertDateTime' is not supported in '$orderby'."
The query that's spat out by the RadGridView/RadDataPager/QueryableDataServiceCollectionView is /odata/v1/MyTable?$orderby=insertDateTime,InsertDateTime&$top=25
How do I fix this?
For context, MyTable has 10 million records with server-side pagination enabled and the records must be sorted by InsertDateTime when first loaded.
Hi Antik,
Would it be possible to share the entire Stack Trace of the exception as well? In addition, can you share the implementation of the AddQueryOption method? Such Issues are usually very specific and with a part of the information it is hard to determine what is causing this.
I am looking forward to your reply.