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

DataServiceQuery and FilterDescriptors

4 Answers 122 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Tim
Top achievements
Rank 1
Tim asked on 24 Jul 2012, 08:29 PM
I am trying to populate a Gridview dynamically based on a DataServiceQuery/IQueryable.  I am querying an OData based service.

IQueryable<myData> query = (IQueryable<myData>)(from mytable in mycontext.myDatas.IncludeTotalCount()
                     select mytable )
               .Where(myFilterDescriptors)
               .Take(0);


I fill a FilterDescriptorCollection (myFilterDescriptors) via the Gridview filtering event. 

The FilterDescriptors are fully populated.

The query is fully functional without the Where, but with it the RequestURI generated is the following:

http://localhost:59108/MyOdataService.svc/MyDatas()?$filter=false&$top=0&$inlinecount=allpages

and the Expression is:

Convert([10000]).IncludeTotalCount().Select(myTable=> myTable).Where(item => (null == "12")).Take(0)

The Member is always null.


Anybody else encounter this issue with FilterDescriptors before?


Cheers and thanks

4 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 25 Jul 2012, 07:02 AM
Hello,

We are not exactly sure how you are filling FilterDescritptors and why. Why are their Members null? How are you passing the myFilterDescriptors to a Where method? Can you send a running sample project?

Have you considered using the RadDataServiceDataSource control? When you bind RadGridView to it it will automatically perform filtering and sorting on the server. You will not have to do anything.

Regards,
Ross
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Tim
Top achievements
Rank 1
answered on 25 Jul 2012, 03:03 PM
I found the issue - I am doing an expand in my DataServiceQuery - the members are null because they are not in the primary class.

The RadDataServiceDataSource does not support grouping.  I am trying to configure paging with grouping.

I also get conflicts between Microsoft.Data.Services.Client and System.Data.Services.Client depending on what I am attempting to do.

I am going to try restructuring and doing it differently.

Is there a sample with Dynamic Linq being used with an OData source for a Gridview?

Cheers,
0
Rossen Hristov
Telerik team
answered on 26 Jul 2012, 07:52 AM
Hi,

Group by is not supported by WCF Data Services client library because there's no support for such operator in the URL query language.

Kind regards,
Ross
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Tim
Top achievements
Rank 1
answered on 26 Jul 2012, 02:54 PM
That is why I built handling to do so via the query itself.  It works - I just had my Linq logic wrong.
Tags
GridView
Asked by
Tim
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Tim
Top achievements
Rank 1
Share this question
or