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

Remove filterdescriptor on column

1 Answer 345 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 11 Feb 2015, 02:36 PM
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...

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 16 Feb 2015, 11:12 AM
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.

 
Tags
GridView
Asked by
Chris
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or