此代码有效,但如果filterValue
与column
中的字段不完全匹配,则无效。除了"Health"
之外,我希望能够过滤"Health Care"
,而"Health"
应该将视图过滤为至少与"Health Care"
string rowFilter = string.Format("[{0}] = '{1}'", columnName, filterValue);
(myDataGridView.DataSource as DataTable).DefaultView.RowFilter = rowFilter;