日期:2014-05-17 浏览次数:20474 次
PagedDataSource Pgds = new PagedDataSource(); Pgds.DataSource = ds.Tables["quizze_list"].DefaultView; Pgds.AllowPaging = true; Pgds.PageSize = 45; lblTotalPage.Text = Pgds.PageCount.ToString(); int current_page; if (Request.QueryString["Page"] != null) { current_page = Convert.ToInt32(Request.QueryString["Page"]); } else { current_page = 1; } // 当前页所引为页码-1 Pgds.CurrentPageIndex = current_page - 1; // 显示当前页码 lblCurrentPage.Text = current_page.ToString(); // 如果不是第一页,通过参数Page设置上一页为当前页-1,否则不显示连接 if (!Pgds.IsFirstPage) { // Request.CurrentExecutionFilePath为当前请求虚拟路径 lnkPrev.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(current_page - 1); } // End If // 如果不是最后一页,通过参数Page设置下一页为当前页+1,否则不显示连接 if (!Pgds.IsLastPage) { // Request.CurrentExecutionFilePath为当前请求虚拟路径 lnkNext.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(current_page + 1); } corp_quizze_list.DataSource = Pgds; corp_quizze_list.DataBind();