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

[Solved] Multiple filter clearing

4 Answers 186 Views
Grid
This is a migrated thread and some comments may be shown as answers.
marco
Top achievements
Rank 1
marco asked on 11 Nov 2009, 02:40 PM
Hi,
I've a RadGrid with one column filtered with a RadComboBox.
Following support examples, I've seen that to clear the RadComboBox filter I've to reset the RadGrid1.MasterTableView.FilterExpression and I've to reset the CurrentFilterValue of the interested column.
This solution works well if I've selected only one filter.
But, if I've other filters applied in other columns, resetting the FilterExpression cause the other filters to be resetted too.
The only solution I've found is to manually rebuild the filterExpression, parsing the string with a complicated regular expression.
Is this the right solution?

Greetings
Marco

4 Answers, 1 is accepted

Sort by
0
Accepted
Pavlina
Telerik team
answered on 16 Nov 2009, 02:17 PM
Hello Marco,

To achieve the required functionality I suggest you examine the code snippet bellow and see if it works as expected:
C#:
protected void clrFilters_Click(object sender, EventArgs e)
{      
    GridBoundColumn column = RadGrid1.MasterTableView.GetColumnSafe("<column UniqueName>") as GridBoundColumn;
    column.CurrentFilterFunction = GridKnownFunction.NoFilter;
    column.CurrentFilterValue = string.Empty;
    RadGrid1.MasterTableView.GetItems(GridItemType.FilteringItem)[0].FireCommandEvent("Filter", new Pair("<column UniqueName>",""));       
}

I hope this helps.

Greetings,
Pavlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
marco
Top achievements
Rank 1
answered on 16 Nov 2009, 03:34 PM
It works.
Thanks, Marco
0
Mark
Top achievements
Rank 1
answered on 22 Feb 2010, 01:03 PM
Is there a way to get an array of radgrid column UniqueName's to feed into this so I can write a generic function for this?
0
Pavlina
Telerik team
answered on 25 Feb 2010, 08:25 AM
Hello Mark,

Please try to use the RenderColumns property, which gets an array of all columns that are used when rendering the grid instance, to achieve your goal.

Greetings,
Pavlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
marco
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
marco
Top achievements
Rank 1
Mark
Top achievements
Rank 1
Share this question
or