更新时间:2023-11-27 08:14:34
使用Datatables.net请看以下链接:
https://datatables.net/ [ ^ ]
http://datatables.net/release-datatables/examples/basic_init/table_sorting.html [ ^ ]
use Datatables.net see following links:
https://datatables.net/[^]
http://datatables.net/release-datatables/examples/basic_init/table_sorting.html[^]
尝试以下调查结果,
Try with following findings,
BindingSource bs = new BindingSource();
bs.DataSource = dataGridView1.DataSource;
bs.Filter = "yourColumnName like '%" + textBox1.Text + "%'";
dataGridView1.DataSource = bs;
或
在搜索文本框更改事件中,请尝试以下操作,
(dataGridView1.DataSource as DataTable).DefaultView.RowFilter = string.Format(Field ='{0}',searchTextBox.Text);
or
In Search Text Box Changed event, try the following,
(dataGridView1.DataSource as DataTable).DefaultView.RowFilter = string.Format("Field = '{0}'", searchTextBox.Text);