I have a Devexpress.XtraGrid.GridControl that I have set the DataSource to a DataTable. I also have several other controls that have databindng to the same DataTable. This works out well so that when the selected row of the GridView changes, the controls reflect the change.
However, on the GridControl‘s GridView I have set the ActiveFilter.NonColumnFilter. This filter changes as the form is used. Occasionally, the filter gets set to something that makes no rows show up in the GridControl. When this happens, the controls that are bound to the DataTable do not clear, but instead show the data from the last selected row.
Is there something simple I can do to tell the bound controls to clear, or do I need to manually go through them all and clear them?
I had previously used a DataTable that actually added and removed rows appropriate to what I was filtering. If the table became clear, all of the bound controls did as well. So I’m assuming it is possible.
I contacted DevExpress about this issue and received a response:
Using this information, I changed from using the
GridView.ActiveFilter.NonColumnFilterfor my filtering needs and instead used theDataTable.DefaultView.RowFilter. That appears to have solved my issue.This was different from the example they gave me:
You can then call this to set the filter: