如何使用标签在GridView中显示数据总数 [英] How to show total number of data in gridview using label

查看:61
本文介绍了如何使用标签在GridView中显示数据总数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我使用此代码:

Hi im using this code:

Label.Text = this.gridview1.Rows.count;



但是当我即时调试程序并单击搜索按钮时,它会显示找到的数据数量= 0.当我再次单击它时,它会显示正确的数字,即找到83个Recod.问题是,当我第一次单击该按钮时,我希望它返回找到的正确数目的记录.请帮助



but when im debugging the program and click search button it shows the number of data = 0 recods find. and when i click it again it shows the correct number which is 83 recods find. the problem is that i want it to return the correct number of records find when i click the button for first time. pls help

推荐答案

Label1.Text = GridView1.Rows.Count.ToString();
Label1.Text = GridView1.Rows.Count.ToString();


绑定标签后网格.
Bind the label after binding the grid.
gridview1.DataSource = ds.Tables[0];
gridview1.DataBind();
Label.Text = this.gridview1.Rows.Count.Tostring();


这篇关于如何使用标签在GridView中显示数据总数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆