在WebForm上放一个Button控件和一个DataGrid控件,如何实现点击一下Button,DataGrid中就显示下一页的数据?(在vs.net2003环境中)
解决方案 »
- select * from HotelUser where HU_Name like '%"+@HU_Name+"%'
- asp.net生成html的静态页面
- 网站被人搞乱
- TreeView错误出现htmlfile: 没有注册类别
- win2003+vs2005 新建网站调试时怎么无法找到站点啊
- DATAGRID中的千進位數字顯示格式
- A应用在处理接受数据处理 插入数据库,B个应用发现数据有增量,直接从数据库取出做处理,显示在页面上。系统响应时间要求在秒级以内。 现在问题是:他们之间如何做
- ewebeditor的焦点问题,高手救助!
- vs2005每次都要build后,才跑程序,怎么不让它build啊?
- .net paypal支付问题
- 请问WAP网站的排版要用什么控制,象捉鱼那样的
- ASP程序与WAP网站的接合问题
如果是自带的分页,把DataGrid的PageIndex加1就可以了。
自己写的也是同样道理。
DataGrid1.AllowCustomPaging=true;
DataGrid1.PageSize=8;if(DataGrid1.CurrentPageIndex>0 && DataGrid1.CurrentPageIndex<DataGrid1.PageCount){
DataGrid1.CurrentPageIndex+=1;
}string selectSql="select * from Student where int_id between "+(DataGrid1.CurrentPageIndex)*DataGrid1.PageSize+1+" and "+(DataGrid1.CurrentPageIndex+1)*DataGrid1.PageSize; -------→①//string selectSql="select * from Student where int_id between 9 and 16"; ------→②
SqlDataAdapter da=new SqlDataAdapter(selectSql,connStr);DataSet ds=new DataSet();da.Fill(ds,"student");DataGrid1.DataSource=ds;
DataGrid1.DataBind();
ds.Clear();
使用①句的话,只显示第一页的记录;使用②句倒可以显示9到16行的记录。我怎样才能做到点击一下按钮,就8行8行的向下显示呢,即第一页显示1-8行的记录,第二页显示9-16行的记录,依次类推。
就可以了
不要忘了重新邦定:DataView dv=(DataView )CreateTable();
DataGrid1 .DataSource =dv;
DataGrid1 .DataBind ();