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

Filter Object Datasource Programmatically

4 Answers 118 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Paul Bishop
Top achievements
Rank 1
Paul Bishop asked on 29 Sep 2008, 01:26 PM
I have a grid bound to an object datasource.  I also have my own filter control that I've created.  How can I filter multiple columns programmatically using my own filter control.  I've tried several examples from the forums and knowledgebase (primariliy setting the CurrentFilterFunction and CurrentFilterValue properties of the individual columns and setting the FilterExpression property of the MasterTableView and rebinding the datasource).  Do I just need to filter my datasource and and rebind it to the grid?

4 Answers, 1 is accepted

Sort by
0
Paul Bishop
Top achievements
Rank 1
answered on 01 Oct 2008, 01:01 PM
bump
0
Yavor
Telerik team
answered on 02 Oct 2008, 06:05 AM
Hello Paul,

You have two options here. First, you can filter the dataSource and rebind the grid. Alternatively, you can set the filter expression for the grid, and rebind it, to achieve the same effect. I hope one of these options are suitable for you.

Kind regards,
Yavor
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Paul Bishop
Top achievements
Rank 1
answered on 02 Oct 2008, 06:08 PM
I think I may have found part of my problem with setting the FilterExpression property on the grid.  I am setting the grid data source in the NeedDataSource method.  After my code fires to set the FilterExpression property of the grid, the NeedDataSource property fires which sets the grid data source back to the unfiltered set of data (which is actually a list of my custom objects).  I have already begun stripping out my code which binds to my custom objects and have started putting together datasets that I can filter and then bind to the grid, but I would much rather use my custom objects if possible.
0
Yavor
Telerik team
answered on 06 Oct 2008, 12:07 PM
Hi Paul,

In this case, you can set the filter expression at a later stage, and rebind the grid. One possible implementation is shown in the following example.
Let me know how it goes.

Regards,
Yavor
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Paul Bishop
Top achievements
Rank 1
Answers by
Paul Bishop
Top achievements
Rank 1
Yavor
Telerik team
Share this question
or