GridView Clearing Filters?

Posted by: loopghost on 10 September 2017, 11:35 am EST

  • Posted 10 September 2017, 11:35 am EST

    I have made the filters on a gridview show/hide-able via a checkbox on my page.


    protected void cbShowActivityFilters_CheckedChanged(object sender, EventArgs e)
    {
    C1GridView2.ShowFilter = cbShowActivityFilters.Checked;
    }

    The only problem is that when I hide the filters, whatever was left in the filters continues to affect the results.

    How can I remove or clear my filters?

    Thanks,
    Jason
    </pre>
  • Replied 10 September 2017, 11:35 am EST

    You additionally need to iterate the columns and set FilterOperator to NoFilter:


    foreach (C1BaseField field in C1GridView1.Columns.Traverse() )


    {


       C1BoundField dataField = field as C1BoundField;


       if (dataField != null)


       {


           dataField.FilterOperator = FilterOperator.NoFilter;


       }


    }

  • Replied 10 September 2017, 11:35 am EST

    I really need a way to clear the filters... anybody??

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels