RIA- Use DataFilter pre-query

2 posts, 0 answers
  1. Rüdiger
    Rüdiger avatar
    6 posts
    Member since:
    Nov 2010

    Posted 01 Mar 2011 Link to this post


    I wonder whether it is possible to use the datafilter pre-query instead of post-query. Is there something that could do the job?

    Otherwise, I had some hope for a scenario like this:
    1. Create unbound datafilter.
    2. Extract query string from datafilter.
    3. Send query-string to server.
    4. On server use Entity-Sql.

    In a recent post (http://www.telerik.com/community/forums/silverlight/data-filter/iterate-filterdescriptors.aspx) one tried to get the tree as a string, you write by using RadDataFilter.FilterDescriptors property. Is that returning an Sql-expression?

  2. Rossen Hristov
    Rossen Hristov avatar
    2478 posts

    Posted 03 Mar 2011 Link to this post

    Hello Rüdiger,

    There are two options.

    A. You can do that if you use RadDomainDataSource (WCF RIA Services) with RadDataFilter. The filtering will be performed directly on the server. Here is an online example.

    In case you are interested in the new RadDomainDataSource control, here are its learning resources:
    Each blog has a runnable sample project attached.

    B. The other option would be to:

    Create an unbound data filter. Let the user create his/her criteria through the UI. Use our extension method called Where. It is located in the QueryableExtensions class. Here is its signature:

    public static IQueryable Where(this IQueryable source, CompositeFilterDescriptorCollection filterDescriptors)

    So you have to pass an IQueryable and RadDataFilter.FilterDescriptors to this method.

    The method will return another IQueryable which will be filtered. You can take the Expression from the IQueryable that is returned.

    You will have a LINQ Expression and you can decide what to do with it from here on.

    I hope this helps.

    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  3. DevCraft R3 2016 release webinar banner
Back to Top