how to rebind my datagridview from database in c#?
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Bryian TanPosted Aug 29, 2010, 8:13 PM
Sorry, I was wrong, there is no DataBind() method with the Window DataGridView control. I'm not sure how you structure your application. Try to rebind it again in code behind
bindingSource1.DataSource = myDataSource;
dataGridView1.DataSource = bindingSource1;
or you can try use the Fill method of the TableAdapter object to reload the data into the DataSet Object.
this.YourTableAdapter.Fill(this.YourDatabaseDataSet.YourTable);
Sam HobbsPosted Aug 29, 2010, 12:07 AM
Sam HobbsPosted Aug 29, 2010, 12:06 AM
aamer ahPosted Aug 28, 2010, 4:48 AM
first thank you for your answer,
but the .DataBind() not found!!
i try to write this function and it's not found!!
Bryian TanPosted Aug 25, 2010, 7:56 PM
The same way you bind the datagridview at the beginning (page load/ button click).
myDataGrid.DataSource = myDataSource;
myDataGrid.DataBind();