parameters

5 posts, 1 answers
  1. Rayne
    Rayne avatar
    241 posts
    Member since:
    Sep 2010

    Posted 22 Nov 2011 Link to this post

    Can we use parameters in the query?
  2. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 23 Nov 2011 Link to this post

    Hello Rayne,

    Can you please provide some kind of a real-world example? How do you want to use parameters? For example, suppose that we have an ObjectContext called NorthwindEntities and it has an ObjectSet property called Customers, how would you go about parameters if you were working solely with Entity Framework?

    We are looking forward to hearing from you.

    Best wishes,
    Ross
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. UI for WPF is Visual Studio 2017 Ready
  4. Rayne
    Rayne avatar
    241 posts
    Member since:
    Sep 2010

    Posted 28 Nov 2011 Link to this post

    What if I don't want to return all 50,000 Customers? The demo shows that the QueryName is Customers (which would be the whole collection). Even then, in my scenario, I have an IsDeleted flag on my entity, so I'd want to return all "Customers" where IsDeleted is false.


  5. Answer
    Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 29 Nov 2011 Link to this post

    Hello Rayne,

    That is called filtering and is possible of course. If you have a RadGridView or RadDataFilter bound to your data source control then filtering will occur out-of-the-box when the user filters through the UI. No code needed.

    In case you want to filter programmatically, you can add a FilterDescriptor instance to the FilterDescriptors collection of the control. For example:

    this.radEntityFrameworkDataSource.FilterDescriptors.Add(new FilterDescriptor("IsDeleted", FilterOperator.IsEqualTo, false));

    This will automatically append a Where clause on the query and send it to the server.

    You can create more complex filtering criteria by combining them with CompositeFilterDescriptor's.

    The same applies for sorting, grouping and paging. For example, if you sort RadGridView, this will automatically be transferred to the server by appending an OrderBy clause on the query. Grouping will append a GroupBy clasue.

    You can bind a RadDataPager to the data source control and you will get paging out-of-the-box as well. It will apppend Skip and Take clauses.

    All of this happens without a single line of code.

    I have attached a sample project which you can play around it and test this functionality. You might need to point the connection string to your local instance of AdventureWorks.

    Let me know if I can help with anything else.

    Kind regards,
    Ross
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  6. Rayne
    Rayne avatar
    241 posts
    Member since:
    Sep 2010

    Posted 29 Nov 2011 Link to this post

    Thanks. I didn't realize that the filtering was done on the server.
Back to Top
UI for WPF is Visual Studio 2017 Ready