Remove filterdescriptor on column

2 posts, 0 answers
  1. Chris
    Chris avatar
    1 posts
    Member since:
    Feb 2015

    Posted 11 Feb 2015 Link to this post

    Hi,

    I am applying a filter to my grid on a hidden column using a form buttons click event (see code below). When I click the button again I want to remove filtering, but only for that particular column i.e. if filtering is already on another column don't reset all filters...

    I've tried using Me.DgvInvoiceData.FilterDescriptors.Remove(filter) but the grid stay the same...

    Any ideas?

     Dim filter As New FilterDescriptor()
    filter.PropertyName = "Custom"
    filter.[Operator] = FilterOperator.IsEqualTo
    filter.Value = "Yes"
    filter.IsFilterEditor = True

    If btnCustom.Text = "Show Only Custom Lines" Then

    Me.DgvInvoiceData.FilterDescriptors.Add(filter)
    btnCustom.Text = "Show All Lines Including Custom"

    Else
    MsgBox("Clearing filter")
    Me.DgvInvoiceData.FilterDescriptors.Remove(filter)

    btnCustom.Text = "Show Only Custom Lines"
    Me.DgvInvoiceData.Refresh()
    End If


    Thanks...
  2. Dimitar
    Admin
    Dimitar avatar
    1411 posts

    Posted 16 Feb 2015 Link to this post

    Hello Chris,

    Thank you for writing.

    You can access the filter descriptor from the column's FilterDescriptor property. For example you can remove the filter as follows:
    radGridView1.FilterDescriptors.Remove(radGridView1.Columns(2).FilterDescriptor)

    Please let me know if there is something else I can help you with. 
     
    Regards,
    Dimitar
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top