Reputation: 21
I have a DataGridView that is populated using a list. During Runtime, the user can filter the data by entering data in a textbox. I am able to do the filtering part.
But the problem i am facing is when i change the datasource to the new datasource in the Textbox1_TextChanged event, the datagridview is populating the data with rows equal to the number of rows in my new datasource but each row is replica of the first row.
When I check the DataSource of the datagridview it has the data of the new DataSource.
So when I check the row selected in the datagridview_doubleclick event, the DataBoundItem gives me the exact object that it should give according the to new datasource.
What might have gone wrong??
Upvotes: 0
Views: 174
Reputation: 2384
Maybe I am wrong, but do you need to clear the DataGridView when binding to a new datasource.... my binding skills are lacking....
Try clearing the DataGridView, before changing the datasource like :
DataGridView.Rows.Clear();
Upvotes: 0