Yes, it is possible but it is kind of a hack.
Step 1: Make your filter values pretty
For this, you'll need to create a class inheriting from SPGridView and override the GetCallbackResult
function:
public class SPFilterGridView : SPGridView
{
protected override string GetCallbackResult()
{
string result = base.GetCallbackResult();
// do something to alter the result
// result = ...;
return result;
}
}
You'll need to debug to get it right but you should be able to clean up the list here.
Step 2: Fix your FilterExpression
After you make your filter values pretty, you'll notice that the filter won't work anymore. This will be due to your FilterExpression
trying to filter on the new "pretty" values instead of the ugly String;#filterexp1
values which are the actual values.
You probably want to override OnPreRender
in your web part to dynamically fix your DataSource's FilterExpression:
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
if (!string.IsNullOrEmpty(_gridDS.FilterExpression))
{
string fieldName = _grid.FilterFieldName;
// TODO: whatever logic to reformat FilterExpression (add String;# in there??)
_gridDS.FilterExpression = string.Format(format, value, fieldName);
}
}