DataGridView not updating in C #

Has anyone received an explanation of what is happening? Changing code 1 to code 2 fixes the problem, although theoretically there should be no difference. (Theory gets into practice like a pumpkin striking a brick wall).


Code 1:

OutputDataGridView.DataSource = myList; 

Code 2:

  OutputDataGridView.DataSource = null; OutputDataGridView.DataSource = myList; 
+6
c # datagridview
source share
2 answers

Look at this link

simple DataGridView update question

+2
source share
 protected void btnWhateverClick(object sender, EventArgs e) { myGridView.DataSourceID = String.Empty; myGridView.DataSource = new int[0]; myGridView.DataBind(); } 

and you're done.

For Ref DataSource in gridview

+1
source share

All Articles