DataServiceQuery and FilterDescriptors

5 posts, 0 answers
  1. Tim
    Tim avatar
    16 posts
    Member since:
    Jul 2012

    Posted 24 Jul 2012 Link to this post

    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
  2. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2477 posts

    Posted 25 Jul 2012 Link to this post

    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.

  3. Tim
    Tim avatar
    16 posts
    Member since:
    Jul 2012

    Posted 25 Jul 2012 Link to this post

    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,
  4. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2477 posts

    Posted 26 Jul 2012 Link to this post

    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.

  5. Tim
    Tim avatar
    16 posts
    Member since:
    Jul 2012

    Posted 26 Jul 2012 Link to this post

    That is why I built handling to do so via the query itself.  It works - I just had my Linq logic wrong.
Back to Top