DataGridView没有在C#中更新 [英] DataGridView not updating in c#
本文介绍了DataGridView没有在C#中更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有人知道发生了什么吗?将代码1更改为代码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).
代码1:
OutputDataGridView.DataSource = myList;
代码2:
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();
}
,您就完成了。
对于引用 gridview中的数据源
这篇关于DataGridView没有在C#中更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文