ListView和gridView 绑定数据不显示
ListView和gridView 绑定数据数据后,页面没有显示数据。要刷新页面才有显示,是什么原因。DataTable gridTable = new DataTable();
string ss = "select top(10) name as Name,inDate as SendDate,inDate as ReadDate, CardNo ,case when IsManager=1 then '1.png' else '2.png'end as image from PersonInfo";
gridTable = SQLHelper.ExecuteDataTable(ss);
listView1.TemplateControlName = "ctlEditMingxi";
listView1.DataSource = gridTable;
listView1.DataBind();
是在线程中更新了listview吗?是的话在线程的末尾加上 this.Client.RenderFlush(); Lula.Jin 发表于 2022-8-25 09:40
是在线程中更新了listview吗?是的话在线程的末尾加上 this.Client.RenderFlush();
private void button1_Press(object sender, EventArgs e)
{
listView1.DataSource = null;
DataTable gridTable = new DataTable();
string ss = "select top(10) name as Name,inDate as SendDate,inDate as ReadDate, CardNo ,case when IsManager=1 then '1.png' else '2.png'end as image from PersonInfo";
gridTable = SQLHelper.ExecuteDataTable(ss, 3135);
listView1.TemplateControlName = "ctlEditMingxi";
listView1.DataSource = gridTable;
listView1.DataBind();
this.Client.RenderFlush();
}
是在button事件里更新
terryxie2006 发表于 2022-8-25 09:44
private void button1_Press(object sender, EventArgs e)
{
listView1.DataSource ...
加上去了还是不行 listView1.TemplateControlName = "ctlEditMingxi";改成 listView1.TemplateControl = new ctlEditMingxi(); 试试 Lula.Jin 发表于 2022-8-25 10:09
listView1.TemplateControlName = "ctlEditMingxi";改成 listView1.TemplateControl = new ctlEditMi ...
也试过了 按BUTTON后按浏览器刷新才能显示,也换了电脑,新建项目。 this.Form.ShowLoadingScreen("等待");
gridTable = SQLHelper.ExecuteDataTable(ss, 3135);
this.Form.CloseLoadingScreen();
这样试试 还是不行,或者有没有页面刷新的方法? Lula.Jin 发表于 2022-8-25 10:21
this.Form.ShowLoadingScreen("等待");
gridTable = SQLHelper.ExecuteDataTable(ss, 3135);
this.For ...
还是不行,或者有没有页面刷新的方法?
页:
[1]
2