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

Remove Filter persistance of RadGrid on outside button click

3 Answers 202 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Nick
Top achievements
Rank 1
Nick asked on 11 Oct 2012, 08:24 AM
HI  Telerik Support,

I am using RadGrid and filtering option is true on the columns.

Now let say I filter the one column by text. it filter data properly.

Now I want to clear the Filter persistence by clicking a button (which is outside the Grid).

Can somebody provide the solutions ASAP. I really need this.

Thanks
Nick

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 11 Oct 2012, 08:53 AM
Hi,

Try the following code to clear filters.
C#:
protected void Button1_Click(object sender, EventArgs e)
{
  foreach (GridColumn column in RadGrid2.MasterTableView.Columns)
  {
      column.CurrentFilterFunction = GridKnownFunction.NoFilter;
      column.CurrentFilterValue = string.Empty;
   }
    RadGrid2.Rebind();
}

Thanks,
Shinu.
0
Nick
Top achievements
Rank 1
answered on 11 Oct 2012, 04:09 PM
This does not reset the FilterExpression. It seems even though I can reset the column filter to NoFilter, and also rebind the grid, the grid is still filtering in the data based upon the FilterExpression.

As I run through each column and reset it to NoFilter, this works fine, buit at the end, even after rebinding, the FilterExpression is still set with the original filtering, and that filtering is applied to the dataset.

Really hoping for an answer to this as the functionality appears to be inconsistent.
0
Shinu
Top achievements
Rank 2
answered on 12 Oct 2012, 03:58 AM
Hi,

Please try the following code snippet to clear filter.

C#:
protected void Button1_Click(object sender, EventArgs e)
{
    foreach (GridColumn column in RadGrid2.MasterTableView.Columns)
    {
        column.CurrentFilterFunction = GridKnownFunction.NoFilter;
        column.CurrentFilterValue = String.Empty;
    }
    RadGrid2.MasterTableView.FilterExpression = String.Empty;
    RadGrid2.Rebind();
}

Thanks,
Shinu.
Tags
Grid
Asked by
Nick
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Nick
Top achievements
Rank 1
Share this question
or