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

[Solved] format of FilterExpression

2 Answers 218 Views
Grid
This is a migrated thread and some comments may be shown as answers.
newbie
Top achievements
Rank 1
newbie asked on 06 Jun 2008, 12:17 AM
In this example http://www.telerik.com/help/aspnet-ajax/grdapplyingdefaultfilteroninitialload.html

The default filter is set using 
 RadGrid1.MasterTableView.FilterExpression = "([Country] LIKE \'%Germany%\') ";

i am trying to capture the filter expression to store it in session and use it for resetting the filter when the control comes back to the page.

The value returned by RadGrid1.MasterTableView.FilterExpression is in the format "(it[\"City\"].ToString().Contains(\"Seattle\"))"

Also the value changes on different GridFunctions.
For an equalTo the format becomes "(Convert.ToString(it[\"City\"]) = \"Seattle\")"

Does the format keep changing for different functions?

I have to set the filter back in the filter textboxes when the control returns to the grid list page from a session variable.

How can i achieve this?





2 Answers, 1 is accepted

Sort by
0
Sebastian
Telerik team
answered on 09 Jun 2008, 11:38 AM
Hello newbie,

The format for the EqualTo function you observed follows the LINQ expressions syntax and can be found only in the ASP.NET 3.5 build of RadGrid for ASP.NET AJAX. If you would like to make your filter syntax consistent with the WHERE clauses of the old T-SQL statements, set the EnableLinqExpressions property of the control to false.
 
Additionally, to restore the grid settings on subsequent page visits, consider the solution presented in this documentation topic (or the approach from the code library thread linked at the bottom of the article):

http://www.telerik.com/help/aspnet-ajax/grdsavingsettingsonperuserbasis.html

Best regards,
Stephen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
newbie
Top achievements
Rank 1
answered on 10 Jun 2008, 11:55 PM
That helped...thanks for the response
Tags
Grid
Asked by
newbie
Top achievements
Rank 1
Answers by
Sebastian
Telerik team
newbie
Top achievements
Rank 1
Share this question
or