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

Grid Filter Option -- "Like"

4 Answers 71 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Punit
Top achievements
Rank 1
Punit asked on 04 Dec 2008, 03:41 AM
Hi

We are implemting grid filtering by giving filter expression in Need_DataSource event by setting following property -

Grid.MasterTableView.FilterExpression

which is set to something like the following

DataSourceProperty.ToString().ToUpper().StartsWith("Hi")  where DataSourceProperty is a property of object, collection of which is set as Data Source to the grid just after setting filter expressio.

Now my problem is that we wnat to give a user option to put % in the filter values and the filter should work like "Like" opertor in Oracle. So the input may be "punit%was%" .

Is it possible to do it?
 
We dont have filtre menu on grid but just filter.

Thanks

4 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 04 Dec 2008, 04:44 AM
Hi Punit,

Try setting the FilterExpression accordingly

RadGrid1.MasterTableView.FilterExpression = "([Country] LIKE \'%Germany%\') ";


More information an be obtained from the link below:

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


Thanks,
Princy
0
Punit
Top achievements
Rank 1
answered on 04 Dec 2008, 08:57 PM
Currently I am setting filter expression  = ProductName.ToString().ToUpper().StartsWith("ABC")
I am not setting any column's CurrentFilterFunction/ CurrentFilterValue property etc.

and it is working fine.

When I changed it for like operator as given above to

 

grid.MasterTableView.FilterExpression = "([ProductName] LIKE '%2001%') ";


it is throwing exception "ParseException Expression Expected".

0
Princy
Top achievements
Rank 2
answered on 05 Dec 2008, 05:53 AM
Hi,

Try turning  off the grid LINQ expressions (EnableLinqExpressions=false)  .
 Hope this helps.

Thanks,
Princy
0
Punit
Top achievements
Rank 1
answered on 06 Dec 2008, 08:19 PM
Thanks this has certainly stopped the exception from coming but now the filtering is not happening.
Tags
Grid
Asked by
Punit
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Punit
Top achievements
Rank 1
Share this question
or