求助Visual Studio 2005(Winform)DataGridView分页 请问Visual Studio 2005(Winform)DataGridView怎么分页,有什么简单的分页方法。我的DataGridView是 从 菜单栏的数据菜单 显示数据源 拖进去的,请教各位 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 如果使用了数据源控件(ojbectDataSource,sqlDatasource...),那么不需要写什么代码,只要将GridView的AllowPaging属性设为True就可以了 我看了 没有这个属性 是Winform 不是asp.net我已经用VS2005的数据工具自动生成了DataGridView控件了,可是都是在一页实现的. 哦,看错了Winform的DataGridView就没有分页,要实现分页就只能自己写代码实现了用分页的存储过程,每次只取出当前一页的数据绑定到DataGridView DataSet set1 = new DataSet("dsSource");DataSet set2 = new DataSet("dsTarget");adapter1.Fill(set1);adapter1.FillSchema(set2, SchemaType.Mapped);DataTable table1 = set1.Tables[0];DataTable table2 = set2.Tables[0]; int num2 = table1.Rows.Count;this.intPageCount = (int) Math.Round(Math.Ceiling(((double) num2) / PAGESIZE));this.ViewState["PageCount"] = this.intPageCount;for (int num1 = 1; ((((this.intCurPageIndex - 1) * PAGESIZE) + num1) <= num2) & (num1 <= PAGESIZE); num1++){ table2.ImportRow(table1.Rows[(((this.intCurPageIndex - 1) * PAGESIZE) + num1) - 1]);}this.dgDb.DataSource = table2.DefaultView; this.dgDb.DataKeyField = "sender"; this.dgDb.DataBind(); 应用传递和值传递的区别 怎么在硬盘上建立一个不限大小的先进后出的缓存文件? C# 中调用可执行程序,怎么才能够确认所调用的可执行文件已经运行完了。 求ce开发中发tabpage加个滚动条及Datagrid加个分页?急!!1 获取表的字段数据类型 怎样响应ListView控件detail方式中的Scroll bar移动时的消息??? outlook里显示邮件内容的那部份是用什么控件? 如何添加数组到list并读出来?谢谢 radiobuttonlist的两个选项可以并排于同一行吗? 有没有人知道怎样用c#压缩xml 如何隐藏被调用程序. 很有点麻烦,不知如何解决,向高手请教、、、、
我已经用VS2005的数据工具自动生成了DataGridView控件了,可是都是在一页实现的.
DataSet set2 = new DataSet("dsTarget");
adapter1.Fill(set1);
adapter1.FillSchema(set2, SchemaType.Mapped);
DataTable table1 = set1.Tables[0];
DataTable table2 = set2.Tables[0];
int num2 = table1.Rows.Count;
this.intPageCount = (int) Math.Round(Math.Ceiling(((double) num2) / PAGESIZE));
this.ViewState["PageCount"] = this.intPageCount;
for (int num1 = 1; ((((this.intCurPageIndex - 1) * PAGESIZE) + num1) <= num2) & (num1 <= PAGESIZE); num1++)
{
table2.ImportRow(table1.Rows[(((this.intCurPageIndex - 1) * PAGESIZE) + num1) - 1]);
}
this.dgDb.DataSource = table2.DefaultView;
this.dgDb.DataKeyField = "sender";
this.dgDb.DataBind();