Beispiel #1
0
    //123
    private void dataListDatabind()
    {
        int currentPage;

        try
        {
            currentPage = Convert.ToInt32(Request.QueryString["p"]);
        }
        catch
        {
            currentPage = 1;
        }
        if (currentPage == 0)
        {
            currentPage = 1;
        }
        ArticleOperate  aop = new ArticleOperate();
        PagedDataSource ps  = new PagedDataSource();

        ps.DataSource                          = aop.viewAll();
        ps.AllowPaging                         = true;
        ps.PageSize                            = 8;
        ps.CurrentPageIndex                    = currentPage - 1;
        this.Pagination1.pageCount             = ps.PageCount;
        this.Pagination1.currentPage           = currentPage;
        this.Pagination1.pageUrl               = "Default.aspx";
        this.Pagination1.paramName             = "p";
        this.DataListViewAllArticle.DataSource = ps;
        //1231231231123123123123123
        this.DataListViewAllArticle.DataBind();
    }
Beispiel #2
0
    protected void datasetbind()
    {
        int currentPage;
        int leibie;

        try
        {
            leibie      = Convert.ToInt32(Request.QueryString["Leibie"]);
            currentPage = Convert.ToInt32(Request.QueryString["page"]);
        }
        catch
        {
            leibie      = 0;
            currentPage = 1;
        }
        if (currentPage == 0)
        {
            currentPage = 1;
        }
        ArticleOperate  aop = new ArticleOperate();
        PagedDataSource ps  = new PagedDataSource();

        if (leibie != 0)
        {
            ps.DataSource = aop.viewAllByleibie(leibie);
        }
        else
        {
            ps.DataSource = aop.viewAll();//数据源为一个链表!,如此之棒,赞~!
        }

        ps.AllowPaging                  = true;
        ps.PageSize                     = 5;
        ps.CurrentPageIndex             = currentPage - 1;
        this.Pagination1.pageCount      = ps.PageCount;
        this.Pagination1.currentPage    = currentPage;
        this.Pagination1.pageUrl        = "Blog.aspx?Leibie=" + leibie;
        this.Pagination1.paramName      = "page";
        this.DataListViewAll.DataSource = ps;
        this.DataListViewAll.DataBind();
        //    this.DataListViewAll.DataKeyField = "ID";
    }
Beispiel #3
0
    protected void datasetbind()
    {
        int currentPage;
        int leibie;
        try
        {
            leibie = Convert.ToInt32(Request.QueryString["Leibie"]);
            currentPage = Convert.ToInt32(Request.QueryString["page"]);
        }
        catch
        {
            leibie = 0;
            currentPage = 1;
        }
        if (currentPage == 0)
        {
            currentPage = 1;
        }
        ArticleOperate aop = new ArticleOperate();
        PagedDataSource ps = new PagedDataSource();
        if (leibie != 0)
        {
            ps.DataSource = aop.viewAllByleibie(leibie);

        }
        else
        {
            ps.DataSource = aop.viewAll();//数据源为一个链表!,如此之棒,赞~!
        }

        ps.AllowPaging = true;
        ps.PageSize = 5;
        ps.CurrentPageIndex = currentPage - 1;
        this.Pagination1.pageCount = ps.PageCount;
        this.Pagination1.currentPage = currentPage;
        this.Pagination1.pageUrl = "Blog.aspx?Leibie=" + leibie;
        this.Pagination1.paramName = "page";
        this.DataListViewAll.DataSource = ps;
        this.DataListViewAll.DataBind();
        //    this.DataListViewAll.DataKeyField = "ID";
    }