I have a RadGrid who's filter expression I am setting from a saved value in a datastore on page load. Setting the filter programmatically seems to work just fine, however, as soon as I try to modify the filter (manually through the web interface) I loose all the filter information set in the page load method. This only happens the first time I change the filters after loading the page. After that, all filtering is persisted properly. Here's the code that programmatically sets the filter expresssion:
The FilterExpression is set on the first line. The loop goes through each column to set the GirdFilterItem's TextBox.
------------------------------------------------------------------------------------------------------------------------------
Example (of what's going one):
RadGrid:
FirstName LastName Age
=================================
Bob Johnson 28
Jane Johnson 28
Sue Hanson 28
John Smith 31
Henry Smith 23
Hilary Porter 31
=================================
On page load, I might set a filter for the 'LastName' column ('Johnson'). After the page loads, I try to manually filter the age column to '28' but it resets the 'LastName' column filter (to NoFilter). When I change the 'LastName' column filter back to 'Johnson', it works just fine and the age filter persists as well. So it's just the first change I make that resets the filters which were programmatically set.
Any help is very welcome!
Trevor
protected void LoadFilterExpressionFromSettings(GridTableView tbView, string filterExpression, Dictionary<
string
, Pair> dicColumns)
{
tbView.FilterExpression = Settings.ListFilterExpression;
foreach(KeyValuePair<
string
, Pair> p in dicColumns)
{
tbView.GetColumn(p.Key).CurrentFilterValue = ((Pair)p.Value).First.ToString();
tbView.GetColumn(p.Key).CurrentFilterFunction = (GridKnownFunction)((Pair)p.Value).Second;
}
}
The FilterExpression is set on the first line. The loop goes through each column to set the GirdFilterItem's TextBox.
------------------------------------------------------------------------------------------------------------------------------
Example (of what's going one):
RadGrid:
FirstName LastName Age
=================================
Bob Johnson 28
Jane Johnson 28
Sue Hanson 28
John Smith 31
Henry Smith 23
Hilary Porter 31
=================================
On page load, I might set a filter for the 'LastName' column ('Johnson'). After the page loads, I try to manually filter the age column to '28' but it resets the 'LastName' column filter (to NoFilter). When I change the 'LastName' column filter back to 'Johnson', it works just fine and the age filter persists as well. So it's just the first change I make that resets the filters which were programmatically set.
Any help is very welcome!
Trevor