I have a need to make minor customizations to the filtering logic in RadGrid for my app. My needs are fairly simple: I have a particular column that's making use of the DataFormatString to display a user friendly representation of a float and I need to intercept the filter command on that column to reformat the user's input so that it matches the underlying datastore rather than the value presented in the GUI.
This sort of thing is very common. So much so that I'm shocked at how little support for it there is in the grid. According to the documentation (here), in order to accomplish this you must do the following:
-K
This sort of thing is very common. So much so that I'm shocked at how little support for it there is in the grid. According to the documentation (here), in order to accomplish this you must do the following:
- Subscribe to the ItemCommand event
- Determine whether or not the command being fired is a filter command
- Determine whether or not the filter command matches a given column
- If so, string parse the entire sql where clause used by the grid so that you can parse out the particular predicate you're interested in
- Then, string parse the predicate to access the given value you want to reformat
- Reformat that value and replace it in the where clause
- Store the reformatted where clause somewhere because you'll then have to...
- Subscribe to the NeedDataSource event
- Replace the grid's default FilterExpression with your custom version
-K