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

[Solved] custom filtering - how to get the filter value?

1 Answer 138 Views
Grid
This is a migrated thread and some comments may be shown as answers.
LH
Top achievements
Rank 1
LH asked on 06 Dec 2009, 08:58 AM

Hello,
We are implementing some custom filtering on rad grid.
We are doing it in a similar approach to the example provided here:
http://www.telerik.com/help/aspnet-ajax/grdoperatewithfilterexpression.html
As in the example, we are handling the Itemcommand event, and in that apply our own custom filtering behavior.

We are looking for a better technique to extract the current filter value from the column we are working on.
Inside the item command event, we execute the following line in order to extract the filter value from the column:

TextBox filterBox = (e.Item as GridFilteringItem)[filterPair.Second.ToString()].Controls[0] as TextBox;   

isn't there a better way? this is wspecially important when we have different column types with different filtering controls. for example, if I have a radComboBox instead of a textbox..

I saw there is a property called CurrentFilterValue for the column, but it shows the old filter value, and is not relevant in the Itemcommand event.

Any suggestions?

1 Answer, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 09 Dec 2009, 04:58 PM
Hi LH,

The ItemCommand will be raised each time you filter a column, giving you a chance to intercept the value. Another option in this case would be to simply iterate through the columns, and get the currentFilterFunction and CurrentFilterValue. Additional information on the syntax is available in the following article:
http://www.telerik.com/help/aspnet-ajax/grdapplyingdefaultfilteroninitialload.html

I hope this helps.

Best wishes,
Pavlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
LH
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Share this question
or