asp.net学习_分页的设计(2)
来源:未知 责任编辑:责任编辑 发表时间:2014-04-20 03:40 点击:次
17: var pager = new Common.RupengPager();
18: pager.UrlFormat = "NewsList.aspx?pagenum={n}&TypeId=" + TypeId;
19: pager.PageSize = 30;
20: pager.TryParseCurrentPageIndex(Request["pagenum"]);
21:
22: //分页数据读取
23: newsBLL bll = new newsBLL();
24: DataTable dt = bll.ListByPaginationForView("Time", pager.PageSize, pager.CurrentPageIndex, "1", strCondition);
25:
26: //获取总页数
27: pager.TotalCount = bll.GetVNewsListCount(strCondition);
28: rpData.DataSource = dt;
29: rpData.DataBind();
30:
31: //渲染页码条HTML
32: PagerHtml = pager.Render();
33: }
34: catch (Exception ex)
35: {
36: logger.Error("错误:", ex);
37: }
38: }
效果也就是这样:
前台就是
1: <%@ Page Language="C#" MasterPageFile="~/InfoPage.master" AutoEventWireup="true" CodeFile="NewsList.aspx.cs" Inherits="News_NewsList" Title="新闻列表" %>
2:
3: <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
4: <link href="../css/other.css" rel="stylesheet" type="text/css" />
5: <link href="../css/Pager.css" rel="stylesheet" type="text/css" />
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>