views:

166

answers:

2

Anyone got an explanation of what's going on? Changing code 1 to code 2 fixes the problem -although theoretically there should be no difference. (Theory hits practice like a pumpkin hitting a brick wall).


Code 1:

 OutputDataGridView.DataSource = myList;


Code 2:

 OutputDataGridView.DataSource = null;
 OutputDataGridView.DataSource = myList;
+1  A: 

Hai Larry Try this

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

Hope this helps

Pandiya Chendur
+2  A: 

Have a look at this link

simple DataGridView refresh question

astander
Thanks, I'll have to read these in more detail as I already have a solution but I don't understand why it works - there's a saying that "the problem that goes away by itself comes back by itself". I'm not sure what the analog is for misunderstood fixes, but maybe "the code that is fixed with a hack will be broken by another hack"
Larry Watanabe