i have datagrid view which uses dataset..
i would like to filter my datagridview by idCardNumber (getting it from the textbox1)
how can i do so? could u explain pls?
i have datagrid view which uses dataset..
i would like to filter my datagridview by idCardNumber (getting it from the textbox1)
how can i do so? could u explain pls?
Hi
i believe you can do this.
DataView MyDataView = MyDataSet.Tables[0].DefaultView;
MyDataView.RowFilter = "IdCardNumber = "+Convert.ToInt32(textbox1.Text)+"";
MyDataGrid.DataSource = MyDataView;
MyDataGrid.DataBind();
This line helps me filtering a DataGridView:
My DataGridView.DataSource = <name>BindingSource
this.<name>BindingSource.Filter = String.Format("<columnname> LIKE '%{0}%'", TextBoxFilter.Text);
The DataGridView and BindingSource were generated automatically.
If you do not use the bindingsource, you can apply a filter by changing the DefaultView of the table which is shown in the grid.
done :) thx
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.