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

Getting GridColumn.CurrentFilterFunction value in NeedDataSource handler

3 Answers 50 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Andy
Top achievements
Rank 1
Andy asked on 13 Oct 2010, 04:36 PM
Hello!
I ran into a weird problem. When I try to get the value of CurrentFilterFunction in NeedDataSource handler, it returns the value from a previous postback, but not the current selection. CurrentFilterValue returns current value fine though.

I'm trying to reduce the number of records in the data source bind to the grid according to the filter settings chosen by a user. Any ideas how to achieve it the best way?

Thanks!

3 Answers, 1 is accepted

Sort by
0
Mira
Telerik team
answered on 18 Oct 2010, 02:38 PM
Hello Andy,

To implement the desired functionality, I recommend that you configure the data source of the grid according to the FilterExpression of the master table view in the NeedDataSource event handler.
Then, to prevent the filtering from the build-in mechanism of the grid, you could store the filter expression and set its property to an empty string. This can happen again in the NeedDataSource event handler.
You should restore the FilterExpression on PreRender of the grid to ensure the correct display of the filter values and functions in the filter item.

Please, give this approach a try and let me know how it goes.

Kind regards,
Mira
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
0
Andy
Top achievements
Rank 1
answered on 18 Oct 2010, 04:28 PM
Hi Mira!
Thank you for the suggestion! Do you have any examples on how the value of FilterExpression can be used to adjust the datasource? Do I need to parse it manually? For datasource I'm using a System.Data.DataTable. 

Best wishes,
Andy
0
Mira
Telerik team
answered on 19 Oct 2010, 01:14 PM
Hello Andy,

You can implement the desired functionality by using the DataTable.Select Method (String). It gets the objects that match the filter criteria.

I hope this helps.

All the best,
Mira
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
Grid
Asked by
Andy
Top achievements
Rank 1
Answers by
Mira
Telerik team
Andy
Top achievements
Rank 1
Share this question
or