2.0中GridView中的分页
来源:互联网 发布:淘宝免费赠送 编辑:程序博客网 时间:2024/05/16 01:20
string connectionString = ConfigurationManager.ConnectionStrings["xinProductsConnectionString"].ConnectionString;
SqlConnection conn = new SqlConnection();
conn.ConnectionString=connectionString;
string sqlstr = "select * from BoardRoom";
SqlDataAdapter da=new SqlDataAdapter(sqlstr,conn);
DataSet ds=new DataSet();
try
{
da.Fill(ds, "word");
PagedDataSource pg = new PagedDataSource();
pg.DataSource = ds.Tables["Word"].DefaultView;
pg.AllowPaging = true;
pg.PageSize = 5;
int currPage;
if (Request.QueryString["page"] != null)
currPage = Convert.ToInt32(Request.QueryString["page"]);
else
currPage = 1;
pg.CurrentPageIndex = currPage - 1;
LabelCurrpage.Text = "当前页:第" + currPage.ToString() + "页";
LabelTotal.Text = "共有:" + pg.PageCount.ToString() + "页";
HyperLinkFirstPage.NavigateUrl = Request.CurrentExecutionFilePath + "?page="+Convert.ToInt32(1);
if (!pg.IsFirstPage)
HyperLinkNextPage.NavigateUrl = Request.CurrentExecutionFilePath + "?page=" + Convert.ToInt32(currPage - 1);
if (!pg.IsLastPage)
HyperLinkPrePage.NavigateUrl = Request.CurrentExecutionFilePath + "?page=" + Convert.ToInt32(currPage + 1);
HyperLinkLastPage.NavigateUrl = Request.CurrentExecutionFilePath + "?page=" + Convert.ToInt32(pg.PageCount);
GridView1.DataSource = pg;
GridView1.DataBind();
- 2.0中GridView中的分页
- C#中GridView中的分页算法重写
- GridView中分页
- asp.net 中的gridview 之gridview 分页
- Gridview中简单分页问题
- ASP.NET中GridView分页
- ASP.NET中GridView分页
- GridView中实现分页 .NET
- ASP.NET中GridView分页
- GridView 中的 checkbox 分页后仍然选中
- ASP:Gridview中的分页和选择
- ASP.NET中GridView的自定义分页
- ASP.NET中GridView的自定义分页
- ASP.NET中GridView的自定义分页
- 在GRIDVIEW中实现完美自定义分页
- ASP.NET中GridView的自定义分页
- ASP.NET中GridView的自定义分页
- GridView控件中分页显示小记
- 系分考试--说说与考试无关的事
- 修改MFC AppWizard向导生成的框架程序的外观和大小
- 发现CSDN的一个Bug
- 爱突发奇想的我 --- 合租,耳机,套套
- 天若有情 -- 胡彦斌
- 2.0中GridView中的分页
- 我的c++学习历程
- 善用 HTML 的 BASE 属性 减少冗余 By Stabx
- google默默记下你访问次数和时间
- 人生要知道的5个故事
- FreeTextBox 1.6.3 中文版使用说明
- 测试收藏
- 今天基本完成任务,界面就差一点了
- 【转】受益终生的十大经典管理学定律