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

Iterate the filters in a RadGridView

8 Answers 109 Views
GridView
This is a migrated thread and some comments may be shown as answers.
scott
Top achievements
Rank 1
scott asked on 26 Jul 2010, 05:42 PM
How can I get the filter expressions - or even the sql generated for the filters - from a RadGridView ?

Thanks

8 Answers, 1 is accepted

Sort by
0
Vanya Pavlova
Telerik team
answered on 27 Jul 2010, 08:59 AM
Hi,

You can call ToString() for the grid FilterDescriptors. Generated SQL can be observed server-side from your LINQ provider. 

All the best,
Vanya Pavlova
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
scott
Top achievements
Rank 1
answered on 28 Jul 2010, 01:33 PM
Hi Vanya.  I'm googling around trying to find out what this means: "Generated SQL can be observed server-side from your LINQ provider." ...  can you give me a hint ?

foreach (ColumnFilterDescriptor fd in fpGrid.FilterDescriptors)
{
    string s = fd.ToString();
    // what comes next ?
}

Many thanks -
Scott
0
Milan
Telerik team
answered on 28 Jul 2010, 01:43 PM
Hello scott,

Could you please give us more details about the end result that you are trying to archive? Why do you need to access your filtering expressions?


Sincerely yours,
Milan
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
scott
Top achievements
Rank 1
answered on 28 Jul 2010, 02:30 PM
Hi Milan.  Those filters are going to become part of an SQL select statement's where clause downstream.  There is code elsewhere that wants to do:

string sql = "select ... from ... where ... AND " + the stuff from the filters.

Scott
0
Vlad
Telerik team
answered on 28 Jul 2010, 03:03 PM
Hi,

 Usually in Silverlight (for example WCF RIA Services binding) RadGridView filters will generate LINQ expressions and these expressions will be transfered to the server-side using service where the same LINQ expressions will be applied to some LINQ context like LINQ to SQL, Entity Framework, Open Access, etc. and this LINQ context will translate the expressions to SQL.

Best wishes,
Vlad
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
scott
Top achievements
Rank 1
answered on 28 Jul 2010, 04:02 PM
I can look at the filter expressions themselves and write a parser that emits the stuff in the proper SQL syntax for each filter operator ... yuck ...  Can you think of a way to create a dummy linq to sql context that I can query for the SQL ?

Scott
0
Vlad
Telerik team
answered on 28 Jul 2010, 04:08 PM
Hi,

 You check this blog post - may help you in your case.

Greetings,
Vlad
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
scott
Top achievements
Rank 1
answered on 28 Jul 2010, 05:35 PM
Hi Vlad.  That blog post was way over my head.  I'd much rather see FilterDescriptor.ToSQL() implemented... Thanks though :)
Tags
GridView
Asked by
scott
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
scott
Top achievements
Rank 1
Milan
Telerik team
Vlad
Telerik team
Share this question
or