Hi all,
I want to find cells in column strSearchFilter that DO contain a value (any value) and hide the rows that DO NOT have a value (i.e. NULL). My code below returns all rows that have NULL in the strSearchFilter column the opposite to what I want.
Thanks
strSearchFilter += string.IsNullOrEmpty(txtFilterValue.Text) ? " IS NULL" : " NOT LIKE '%" + txtFilterValue.Text + "%'";
}
private void performFilter(string strFilterText)
{
DataTable table = dataGridView1.DataSource as DataTable;
if (table != null)
{
List<DataRow> filteredRows = new List<DataRow>(table.Select(strFilterText));
CurrencyManager cm = (CurrencyManager)BindingContext[dataGridView1.DataSource];
cm.SuspendBinding();
foreach (DataGridViewRow row in dataGridView1.Rows)
{
row.Visible = filteredRows.Contains(((DataRowView)row.DataBoundItem).Row);
}
cm.ResumeBinding();
}
}
Thanks for the help.