开发者

DataGridView not updating in c# [duplicate]

This question already has answers here: Refresh DataGridView when updating data source (8 answers) Closed 3 years ago.

Anyone got an explanation of what's going on? Changing code 1 to code 2 fixes the problem -although theoretically there should be no differ开发者_运维问答ence. (Theory hits practice like a pumpkin hitting a brick wall).


Code 1:

 OutputDataGridView.DataSource = myList;

Code 2:

 OutputDataGridView.DataSource = null;
 OutputDataGridView.DataSource = myList;


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜