How to clean Excel like filters

3 posts, 0 answers
  1. Mauricio
    Mauricio avatar
    2 posts
    Member since:
    Jan 2012

    Posted 02 Feb 2012 Link to this post


    I have enabled the Excel like filtering, but every time I change the DataSource on the radGridView, the filter for a column is not updated. I have tried to clean the filters using:



    But those collections are empty, since I'm not creating my own filters. Any help will be appreciated.
  2. Mauricio
    Mauricio avatar
    2 posts
    Member since:
    Jan 2012

    Posted 03 Feb 2012 Link to this post

    I found a solution. To update the value that are shown on the "Excel" filters after changing the value of the DataSource, I have
    to add a new row to the radGridView. (and then i remove it since I do not need it). Is this the only way to update the value of this filters? I feel like is not the right way to do it.

  3. Stefan
    Stefan avatar
    2908 posts

    Posted 07 Feb 2012 Link to this post

    Hello Mauricio,

    Thank you for writing.

    If you have bound the grid and added some filtering for a column via the Excel-like filtering dialog, this automatically creates a FilterDescriptor according to the filtering conditions and this descriptor is added to the FilterDescriptors collection of the template. So when you change the data source of your grid, this filter is preserved if the columns schema of the new data source is the same as the previous one and the filters are cleared if the columns' schema is different. 

    If you want to remove the filters upon changing the data source, call the Clear method of the FilterDescriptors collection of the desired template. Alternatively, if you want to keep them and if your data schema is the same, just change the data source and the filter will be kept. Attached you can find a sample project demonstrating both approaches. 

    Let me know if you have any additional questions.
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Back to Top