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

Problem with custom GridBoundColumn and FilterTemplate

1 Answer 64 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Michael Maluck
Top achievements
Rank 1
Michael Maluck asked on 17 Jul 2010, 07:45 PM
I have use a filter template for one column that uses several controls. I thought the right way to get values out of a custom filter template would be to derive from GridBoundColumn and override the methods SetCurrentFilterValueToControl and GetCurrentFilterValueFromControl. Unfortunately when setting a filter with the UI and initiate a postback with the JavaScript function tableView.filter the first thing that gets called is SetCurrentFilterValueToControl. I expected a Get call but not a Set one. In the set method I set the filter controls to values that are saved in the session. This way I lose the settings made by the user. After having lost the user's filter wish the ItemCommand of RadGrid fires and after that the GetCurrentFilterValueFromControl of the column.

I tried to find out what the right way is by removing the filter template and watch the event calling order with RadGrids default text filter. When filtering now the first method called is also SetCurrentFilterValueToControl. But when looking at the CurrentFilterValue property of the column I could see that some magic already set it to the correct value. This has happened without a call to GetCurrentFilterValueFromControl.

My understanding was to override GetCurrentFilterValueFromControl to read values of the controls inside a custom filter template and to override SetCurrentFilterValueToControl to set values of the controls. What is the right way to interact between CurrentFilterValue and a custom filter template?

1 Answer, 1 is accepted

Sort by
0
Michael Maluck
Top achievements
Rank 1
answered on 18 Jul 2010, 12:31 PM
When calling tableView.filter, RadGrid immediately sets the filter controls to the provided filter parameter. Ok, that makes sense. As I do not want to build the filter in JavaScript I just send a pattern now that I recognize in SetCurrentFilterValueToControl.
Tags
Grid
Asked by
Michael Maluck
Top achievements
Rank 1
Answers by
Michael Maluck
Top achievements
Rank 1
Share this question
or