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

Handling the Expired Filter

1 Answer 50 Views
Grid
This is a migrated thread and some comments may be shown as answers.
gijo
Top achievements
Rank 1
gijo asked on 23 Sep 2010, 12:45 PM
I am working on a specific requirement in Rad grid. Encounter an issue while deleting all the data corresponding to a current filter and reloads the page with the filter expression still in the combo box.

I was hoping to tackle this situation by setting the Current filter value to "All" but not successful.

RadGrid1.MasterTableView.GetColumn("Name").CurrentFilterValue = "All";

But still RadGrid1.MasterTableView.FilterExpression contains the expression for the deleted data. In prevsious version for 3.5 I could handle this situation by replacing the filter expression by string manipulation and setting the filter expression to the radgrid once again. But in the upgraded version targeting .netframework 4.0, this is not possible as the filter expression is different from that of .net 3.5 version and difficult to replace the expired value.

Is there a way to handle the filter expression for data deleted from the database, but the expression still remains in the combo box. I have a number of filter expressions but would like to avoid only those filters which don't have data exists in the database.


1 Answer, 1 is accepted

Sort by
0
Mira
Telerik team
answered on 28 Sep 2010, 12:55 PM
Hello Gijo,

Please use the following code to clear the filters of the grid:
RadGrid1.MasterTableView.FilterExpression = string.Empty;
 
foreach (GridColumn column in RadGrid2.MasterTableView.RenderColumns)
{
    if (column is GridBoundColumn)
    {
        GridBoundColumn boundColumn = column as GridBoundColumn;
        boundColumn.CurrentFilterValue = string.Empty;
    }
}
 
RadGrid1.MasterTableView.Rebind();
You can see how it works in the Filter Templates demo.

I hope this helps.

Sincerely yours,
Mira
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
gijo
Top achievements
Rank 1
Answers by
Mira
Telerik team
Share this question
or