筛选代码:
private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
{
DataTable dt = dataGridView1.DataSource as DataTable;
DataView dv = dt.DefaultView;
switch(comboBox2.Text)
{
case "全部":
dv.RowFilter = "状态='已配准' or 状态='未配准'" ;
break;
case "已配准":
dv.RowFilter="状态='"+comboBox2.Text+"'";
break;
case "未配准":
dv.RowFilter="状态='"+comboBox2.Text+"'";
break;
}
}
选中全部时,不行啊
------解决方案--------------------
dv.RowFilter=null 或者dv.RowFilter ="" 试试