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

How to get the Filter Expression in XML Formet

1 Answer 129 Views
Filter
This is a migrated thread and some comments may be shown as answers.
Gaurav
Top achievements
Rank 1
Gaurav asked on 03 Nov 2010, 01:28 PM
Hello All,

I have to use the RAD Filter on the DataSource at place of the current view of the grid. and this I am doing with the RAD Filter for DataSource.
But my problem is that the I want to fetch the  "Filter Expression" generated by the  RADFilter ; and make it convert in to the XML format.

For example:
<FilterExpression>
<Expression1>
<DataFiledName>EmployeID</DataFiledName>
<Operator>=</Operator>
<DataFiledValue>1</DataFiledValue>
</Expression1>
<Expression2>
<DataFiledName>DepartmentName</DataFiledName>
<Operator>Like</Operator>
<DataFiledValue>Finance</DataFiledValue>
</Expression2>
</FilterExpression>

Please Help me to do the same....

Thanks in Advance!!!

1 Answer, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 09 Nov 2010, 10:26 AM
Hello Gaurav,

You need to handle the OnApply event of RadFilter and extract the filter expression there, by performing these steps:
  1. A query provider is declared. The query provider will determine the type of the filter expression, and its syntax. For example, Sql, Linq, Oql or EntitySql.
  2. The ProcessGroup() method of the above-declared provided is called. This causes the filter expression to be stored in the .Result variable of the provider.
  3. The provider.Result variable can be accessed directly, to get the filter expression.
For example:
protected void RadFilter1_Apply(object sender, EventArgs e)
{
   RadFilterSqlQueryProvider provider = new RadFilterSqlQueryProvider();
   provider.ProcessGroup(RadFilter1.RootGroup);
   var r = provider.Result;
   Response.Write(r);
}


Sincerely yours,
Tsvetina
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
Tags
Filter
Asked by
Gaurav
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
Share this question
or