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

[Solved] Multiple Filtering Criteria

2 Answers 205 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 02 Jun 2008, 06:05 PM
Hello,

I would like to know the best way to implement filtering on a RadGrid with multiple criteria.  For example I would like to be able to dynamically build a query on a column such as "WHERE Name CONTAINS 'A' OR Name CONTAINS 'B' OR Name CONTAINS 'C'".

I have implemented custom filtering with a dropdownlist on a column based on the article found here.  My dropdownlist will have some items that need to filter on multiple criteria and others that should only filter on one criteria.  Any help you can give would be greatly appreciated. 

Thanks,
Mike

2 Answers, 1 is accepted

Sort by
0
Michael
Top achievements
Rank 1
answered on 02 Jun 2008, 07:02 PM
Ok, so i have found FilterExpression property of the MasterTableView.  And now I can set a custom filter using code such as:

myGrid.MasterTableView.FilterExpression = "[Name] = 'ATL' OR [Name] = "NYC" OR [Name] = "DC";
myGrid.Rebind();


But is there not a way to do this from a custom GridTemplateColumn class?  I would think that since I extended the GridTemplateColumn class that I would be able to specify some sort of custom filtering algorithm instead of handling the filtering at the Grid level on the page.  Is this possible to build into the column class?
0
Bodevain Svensson
Top achievements
Rank 1
answered on 05 Jun 2008, 10:20 AM
I am not sure whether isolating such type of algorythm inside a custom template column class is a good idea as I can not see how you will synchronize this algorythm with multi-column filtering for the rest of the grid columns. The better practice IMHO is to operate with the FilterExpression property directly and modify it based on your custom conditions/logic.

Bodevain
Tags
Grid
Asked by
Michael
Top achievements
Rank 1
Answers by
Michael
Top achievements
Rank 1
Bodevain Svensson
Top achievements
Rank 1
Share this question
or