• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# PagedDataSource类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中PagedDataSource的典型用法代码示例。如果您正苦于以下问题:C# PagedDataSource类的具体用法?C# PagedDataSource怎么用?C# PagedDataSource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PagedDataSource类属于命名空间,在下文中一共展示了PagedDataSource类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: bindNew

 protected void bindNew()
 {
     //获取当前页码
     int noncePage = Convert.ToInt32(labPage.Text);
     //创建PagedDataSource对象用来实现分页
     PagedDataSource ps = new PagedDataSource();
     string sqlSel = "select * from videoInfo where Auditing='1' order by videoDate desc";
     //调用公共类中的getRows方法并将所返回的所有数据绑定到PagedDataSource数据源中
     ps.DataSource = operateData.getRows(sqlSel).DefaultView;
     //设置启动分页
     ps.AllowPaging = true;
     //设置每页显示的项数
     ps.PageSize = 8;
     //设置当前页的索引
     ps.CurrentPageIndex = noncePage - 1;
     this.lnkbtnFront.Enabled = true;
     this.lnkbtnNext.Enabled = true;
     this.lnkbtnLast.Enabled = true;
     this.lnkbtnFirst.Enabled = true;
     //如果当前为第一页将不显示第一页按钮和上一页按钮
     if (noncePage == 1)
     {
         this.lnkbtnFirst.Enabled = false;//不显示第一页按钮
         this.lnkbtnFront.Enabled = false;//不显示上一页按钮
     }
     //如果当前为最后一页将不显示最后一页按钮和下一页按钮
     if (noncePage == ps.PageCount)
     {
         this.lnkbtnNext.Enabled = false;//不显示下一页
         this.lnkbtnLast.Enabled = false;//不显示最后一页
     }
     labBackPage.Text = Convert.ToString(ps.PageCount);
     dlNewVideo.DataSource = ps;
     dlNewVideo.DataBind();
 }
开发者ID:kinggod,项目名称:21SourceCode,代码行数:35,代码来源:videoNew.aspx.cs


示例2: dlBind

    /// <summary>
    /// DataList控件绑定及分页
    /// </summary>
    /// <param name="intCount">每页显示的记录条数</param>
    /// <param name="ds">DataSet数据集</param>
    /// <param name="labPage">当前页码</param>
    /// <param name="labTPage">总页码</param>
    /// <param name="lbtnUp">上一页</param>
    /// <param name="lbtnNext">下一页</param>
    /// <param name="lbtnBack">最后一页</param>
    /// <param name="lbtnOne">第一页</param>
    /// <param name="dl">DataList控件对象</param>
    public static void dlBind(int intCount, DataSet ds, Label labPage, Label labTPage, LinkButton lbtnUp, LinkButton lbtnNext, LinkButton lbtnBack, LinkButton lbtnOne, Repeater dl)
    {
        int curpage = Convert.ToInt32(labPage.Text);
        PagedDataSource ps = new PagedDataSource();
        ps.DataSource = ds.Tables[0].DefaultView;
        ps.AllowPaging = true; //是否可以分页
        ps.PageSize = intCount; //显示的数量
        ps.CurrentPageIndex = curpage - 1; //取得当前页的页码

        lbtnNext.Visible = true;
        lbtnOne.Visible = true;
        lbtnBack.Visible = true;
        lbtnUp.Visible = true;

        lbtnNext.Enabled = true;
        lbtnBack.Enabled = true;
        lbtnOne.Enabled = true;
        if (curpage == 1)
        {
            lbtnOne.Visible = false;//不显示第一页按钮
            lbtnUp.Visible = false;//不显示上一页按钮
        }
        if (curpage == ps.PageCount)
        {
            lbtnNext.Visible = false;//不显示下一页
            lbtnBack.Visible = false;//不显示最后一页
        }
        labTPage.Text = Convert.ToString(ps.PageCount);
        dl.DataSource = ps;
           // dl.DataKeyField = "ID";
        dl.DataBind();
    }
开发者ID:gqb101112,项目名称:ZCoder,代码行数:44,代码来源:DataOperate.cs


示例3: dlImageBind

 public void dlImageBind()
 {
     string strSql = "select * from tb_Image";
     DataTable dsTable = dbObj.GetDataSetStr(strSql, "tbImage");
     int curpage = Convert.ToInt32(this.labPage.Text);
     PagedDataSource ps = new PagedDataSource();
     ps.DataSource = dsTable.DefaultView;
     ps.AllowPaging = true; //是否可以分页
     ps.PageSize = 16; //显示的数量
     ps.CurrentPageIndex = curpage - 1; //取得当前页的页码
     this.lnkbtnUp.Enabled = true;
     this.lnkbtnNext.Enabled = true;
     this.lnkbtnBack.Enabled = true;
     this.lnkbtnOne.Enabled = true;
     if (curpage == 1)
     {
         this.lnkbtnOne.Enabled = false;//不显示第一页按钮
         this.lnkbtnUp.Enabled = false;//不显示上一页按钮
     }
     if (curpage == ps.PageCount)
     {
         this.lnkbtnNext.Enabled = false;//不显示下一页
         this.lnkbtnBack.Enabled = false;//不显示最后一页
     }
     this.labBackPage.Text = Convert.ToString(ps.PageCount);
     this.dlImage.DataSource = ps;
     this.dlImage.DataKeyField = dsTable.Columns[0].ToString();
     this.dlImage.DataBind();
 }
开发者ID:kinggod,项目名称:21SourceCode,代码行数:29,代码来源:imagery.aspx.cs


示例4: dlBind

    public void dlBind()
    {
        int curpage = Convert.ToInt32(labNowPage.Text);
        PagedDataSource ps = new PagedDataSource();
        string sqlStr = "SELECT * FROM tb_Reply WHERE ReplyID='" + Request["ID"].ToString() + "'";
        SqlCommand myCmd=dbObj.GetCommandStr(sqlStr);
        DataTable dsTable = dbObj.GetDataSet(myCmd, "tbReplay");
        ps.DataSource = dsTable.DefaultView;
        ps.AllowPaging = true; //是否可以分页
        ps.PageSize = 10; //显示的数量
        ps.CurrentPageIndex = curpage - 1; //取得当前页的页码
        lnkbtnPrve.Enabled = true;
        lnkbtnTop.Enabled = true;
        lnkbtnNext.Enabled = true;
        lnkbtnLast.Enabled = true;
        if (curpage == 1)
        {
            lnkbtnTop.Enabled = false;//不显示第一页按钮
            lnkbtnPrve.Enabled = false;//不显示上一页按钮
        }
        if (curpage == ps.PageCount)
        {
            lnkbtnNext.Enabled = false;//不显示下一页
            lnkbtnLast.Enabled = false;//不显示最后一页

        }
        this.labCount.Text = Convert.ToString(ps.PageCount);
        this.DataList1.DataSource = ps;
        this.DataList1.DataKeyField = "ID";
        this.DataList1.DataBind();
    }
开发者ID:kinggod,项目名称:21SourceCode,代码行数:31,代码来源:LeaveWordView.aspx.cs


示例5: grdbind

    public void grdbind()
    {
        using (Entities bll = new Entities())
                {

                    IEnumerable<L_RForm> lfeed;
                    if (!string.IsNullOrEmpty(Request.Params["ID"]))
                    {
                        _Id = int.Parse(HttpContext.Current.Request.QueryString["ID"]);
                        lfeed = bll.L_RForm.Where(p => p.FID == _Id).OrderByDescending(p => p.FID).Select(c => c);
                    }
                    else
                    {
                        lfeed = bll.L_RForm.OrderByDescending(p => p.FID).Select(c => c);

                    }

                    PagedDataSource pds = new PagedDataSource();
                    pds.DataSource = lfeed.ToList();  //这里好像一定要Tolist();不然会有点错误;
                    pds.AllowPaging = true;
                    AspNetPager1.RecordCount = lfeed.Count(); //记录总数;
                    pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1;
                    pds.PageSize = AspNetPager1.PageSize;
                    this.rptList.DataSource = pds;
                    this.rptList.DataBind();
                }
    }
开发者ID:priceLiu,项目名称:CMS,代码行数:27,代码来源:RList.aspx.cs


示例6: DataListBindCourseNotify

    protected void DataListBindCourseNotify()
    {
        DalOperationAboutCourses doac = new DalOperationAboutCourses();
        DataView dv = doac.GetCoursesInfo(Master.courseNo,Master.classID,Master.termtag, "3").Tables[0].DefaultView;//第3个标签,绑定课程通知信息

        this.AspNetPager2.RecordCount = dv.Count;

        PagedDataSource pds = new PagedDataSource();    //定义一个PagedDataSource类来执行分页功
        pds.DataSource = dv;
        pds.AllowPaging = true;

        pds.CurrentPageIndex = pageIndex - 1;
        pds.PageSize = CommonUtility.pageSize; ;

        this.dlstCourseNotify.DataSource = pds;
        this.dlstCourseNotify.DataBind();

        if (this.dlstCourseNotify.Items.Count == 0)
        {
            btnDelete.Visible = false;
        }
        else
        {
            btnDelete.Visible = true;
        }

        if (pds.Count > 0)
        {
            this.dlstCourseNotify.ShowFooter = false;
        }
    }
开发者ID:skyaspnet,项目名称:usta,代码行数:31,代码来源:CInfoCourseNotify.aspx.cs


示例7: FilterSearch

    public void FilterSearch()
    {
        if (Session["kindid"] != null && Session["name"] != null)
        {
            PagedDataSource objPage = new PagedDataSource();
            try
            {
                DataSet ds = new DataSet();
                ds = getDS.getData("Product");
                DataTable dt = new DataTable();
                dt = ds.Tables[0];

                DataView dv = new DataView(dt);
                dv.RowFilter = "KindID = '" + Session["kindid"].ToString() + "' and ProName = '" + Session["name"].ToString() + "'";

                DataList1.RepeatColumns = 3;
                DataList1.DataSource = dv;
                DataList1.DataBind();
            }
            catch (Exception ex)
            {

            }
            finally
            {
                objPage = null;
            }
        }
        else
        {

        }
    }
开发者ID:linhtnn,项目名称:aspx-basic-OnlineShoppingCart,代码行数:33,代码来源:ViewSearch.ascx.cs


示例8: dlBind

    public void dlBind()
    {
        int curpage = Convert.ToInt32(labNowPage.Text); //当前页
        PagedDataSource ps = new PagedDataSource(); //定义一个PagedDataSource类对象
        //获取留言信息
        string strSql = "SELECT * FROM tb_LeaveWord WHERE Uid='" + Session["UserName"].ToString() + "'";
        SqlCommand myCmd = dbObj.GetCommandStr(strSql);
        DataTable dsTable = dbObj.GetDataSet(myCmd, "tbLeaveWord");
        ps.DataSource =dsTable.DefaultView;
        ps.AllowPaging = true; //是否可以分页
        ps.PageSize = 10; //显示的数量
        ps.CurrentPageIndex = curpage - 1; //取得当前页的页码
        lnkbtnPrve.Enabled = true;
        lnkbtnTop.Enabled = true;
        lnkbtnNext.Enabled = true;
        lnkbtnLast.Enabled = true;
        if (curpage == 1)
        {
            lnkbtnTop.Enabled = false;//不显示第一页按钮
            lnkbtnPrve.Enabled = false;//不显示上一页按钮
        }
        if (curpage == ps.PageCount)
        {
            lnkbtnNext.Enabled = false;//不显示下一页
            lnkbtnLast.Enabled = false;//不显示最后一页

        }
        this.labCount.Text = Convert.ToString(ps.PageCount);//页的总数
        //绑定DataList控件,显示留言信息
        this.dlMyWord.DataSource = ps;
        this.dlMyWord.DataKeyField = "ID";
        this.dlMyWord.DataBind();
    }
开发者ID:kinggod,项目名称:21SourceCode,代码行数:33,代码来源:MyWord.aspx.cs


示例9: dlBind

    public void dlBind()
    {
        int curpage = Convert.ToInt32(labNowPage.Text);
        PagedDataSource ps = new PagedDataSource();
        string strSql = "SELECT * FROM tb_LeaveWord order by DateTime Desc";
        SqlCommand myCmd = dbObj.GetCommandStr(strSql);
        DataTable dsTable = dbObj.GetDataSet(myCmd, "tbLeaveWord");
        ps.DataSource = dsTable.DefaultView;
        ps.AllowPaging = true; //是否可以分页
        ps.PageSize = 10; //显示的数量
        ps.CurrentPageIndex = curpage - 1; //取得当前页的页码
        lnkbtnPrve.Enabled = true;
        lnkbtnTop.Enabled = true;
        lnkbtnNext.Enabled = true;
        lnkbtnLast.Enabled = true;
        if (curpage == 1)
        {
            lnkbtnTop.Enabled = false;//不显示第一页按钮
            lnkbtnPrve.Enabled = false;//不显示上一页按钮
        }
        if (curpage == ps.PageCount)
        {
            lnkbtnNext.Enabled = false;//不显示下一页
            lnkbtnLast.Enabled = false;//不显示最后一页

        }
        this.labCount.Text = Convert.ToString(ps.PageCount);
        this.dlManage.DataSource = ps;
        this.dlManage.DataKeyField = "ID";
        this.dlManage.DataBind();
    }
开发者ID:kinggod,项目名称:21SourceCode,代码行数:31,代码来源:LeaveWordManage.aspx.cs


示例10: BindList

    protected void BindList()
    {
        // edit by shiney
        string type = ViewState["type"].ToString();
        DataTable dt = AccessHelper.ExecuteDataTable(strConnection, CommandType.Text,
            "select C.ID,C.Title,C.CreateTime,C.ViewTimes,T.TypeCode  from Contents C,ContentAndType CT,ContentType T where C.ID=CT.ContentID And T.ID=CT.TypeID And T.TypeCode='" + type + "'");
         //                       "SELECT ID, Title, CreateTime,ViewTimes FROM Contents WHERE TypeCode = '" + type + "'");
        if (dt == null) return;
        if (dt.Rows.Count == 0)
        {
            dvEmpty.InnerHtml += "此栏目暂无信息";
            dvbtn.Visible = false;
        }

        if (dt.Rows.Count > 0) dvbtn.Visible = true;
        PagedDataSource ps = new PagedDataSource();
        ps.AllowPaging = true;
        ps.PageSize = 16;
        rpList.DataSource = ps;
        ps.CurrentPageIndex = Convert.ToInt32(this.lbCurPage.Text) - 1;
        ps.DataSource = dt.DefaultView;

        this.btnPreviousPage.Enabled = true;
        this.btnNextPage.Enabled = true;
        if (ps.CurrentPageIndex == 0)
        {
            this.btnPreviousPage.Enabled = false;
        }
        if (ps.CurrentPageIndex == ps.PageCount - 1)
        {
            this.btnNextPage.Enabled = false;
        }
        rpList.DataBind();
    }
开发者ID:dalinhuang,项目名称:cqwz,代码行数:34,代码来源:ContentList.aspx.cs


示例11: DataListBind

    //绑定用户信息到DataList
    public void DataListBind()
    {
        DalOperationFeedBack dou = new DalOperationFeedBack();
        DataView dv = dou.FindFeedBack().DefaultView;

        this.AspNetPager1.RecordCount = dv.Count;

        PagedDataSource pds = new PagedDataSource();    //定义一个PagedDataSource类来执行分页功
        pds.DataSource = dv;
        pds.AllowPaging = true;

        pds.CurrentPageIndex = pageIndex - 1;
        pds.PageSize = AspNetPager1.PageSize;

        this.dlFeedBack.DataSource = pds;
        this.dlFeedBack.DataBind();

        if (this.dlFeedBack.Items.Count == 0)
        {
            btnDelete.Visible = false;
        }
        else
        {
            btnDelete.Visible = true;
        }

        if (pds.Count > 0)
        {
            this.dlFeedBack.ShowFooter = false;
        }
    }
开发者ID:skyaspnet,项目名称:usta,代码行数:32,代码来源:ViewFeedBack.aspx.cs


示例12: BindList

    protected void BindList()
    {
        // edit by shiney
        DataTable dt = AccessHelper.ExecuteDataTable(strConnection, CommandType.Text,
                            "SELECT *  FROM FileList where IsDisplay = true");
        //if (dt == null) return;
        if (dt.Rows.Count == 0)
        {
            dvEmpty.InnerHtml += "此栏目暂无信息";
            dvbtn.Visible = false;
        }
        if (dt.Rows.Count > 0) dvbtn.Visible = true;

        PagedDataSource ps = new PagedDataSource();
        ps.AllowPaging = true;
        ps.PageSize = 10;
        rpList.DataSource = ps;
        ps.CurrentPageIndex = Convert.ToInt32(this.lbCurPage.Text) - 1;
        ps.DataSource = dt.DefaultView;

        this.btnPreviousPage.Enabled = true;
        this.btnNextPage.Enabled = true;
        if (ps.CurrentPageIndex == 0)
        {
            this.btnPreviousPage.Enabled = false;
        }
        if (ps.CurrentPageIndex == ps.PageCount - 1)
        {
            this.btnNextPage.Enabled = false;
        }
        rpList.DataBind();
    }
开发者ID:dalinhuang,项目名称:cqwz,代码行数:32,代码来源:FileDownload.aspx.cs


示例13: LoadPagedData

    protected override void LoadPagedData()
    {
        List<Branch> branchesList = branchesOperator.SelectBySupplierID(Convert.ToInt32(Request.QueryString["SuppID"]), (bool?)IsArabic);

        if (branchesList != null && branchesList.Count > 0)
        {
            PagedDataSource pager = new PagedDataSource();

            pager.DataSource = branchesList;
            pager.AllowPaging = true;
            pager.PageSize = 10;
            pager.CurrentPageIndex = CurrentPage;

            if (pager.PageCount > 1)
            {
                btnMoveNext.Visible = true;
                btnMovePrevious.Visible = true;
                btnMoveNext.Enabled = !pager.IsLastPage;
                btnMovePrevious.Enabled = !pager.IsFirstPage;
            }

            rptBranches.DataSource = pager;
            rptBranches.DataBind();

            lblEmptyDataMessage.Visible = false;
        }
        else
        {
            btnMoveNext.Visible = false;
            btnMovePrevious.Visible = false;
            lblEmptyDataMessage.Visible = true;
        }
    }
开发者ID:mrofferz,项目名称:mrofferz,代码行数:33,代码来源:SupplierBranchesListCtrl.ascx.cs


示例14: renderview

    protected void renderview(object sender, EventArgs e)
    {
        GridViewRow gvr = (sender as GridView).BottomPagerRow;
        if (gvr != null)
        {
            gvr.Visible = true;
        }

        PagedDataSource ps = new PagedDataSource();
        ps.DataSource = ods.Select();
        if (ps.DataSourceCount > 0)
        {
            try
            {
                (gvr.FindControl("ddlPageSize") as DropDownList).SelectedValue = gridList.PageSize.ToString();
            }
            catch (ArgumentOutOfRangeException ae)
            {
                (gvr.FindControl("ddlPageSize") as DropDownList).SelectedIndex = 0;
            }
            (gvr.FindControl("lblTotalRecord") as Label).Text = ps.DataSourceCount.ToString();

            this.hidcurpage.Value = (gridList.PageIndex + 1).ToString();
        }
    }
开发者ID:TheProjecter,项目名称:wgiadunion,代码行数:25,代码来源:Message.aspx.cs


示例15: GetItems

    public void GetItems()
    {
        if (Convert.ToInt32(Session["CurrentPage"].ToString()) != 0)
        {
            CurrentPage = Convert.ToInt32(Session["CurrentPage"].ToString());
        }

        DataTable dtDB = new DataTable("ItemInfo");
        DataTable dtDB1 = new DataTable("ItemInfo1");

        if (  Request.QueryString["categoryid"] == null || Request.QueryString["categoryid"]=="")
        {
            SqlDataAdapter adpDB = new SqlDataAdapter("Select  productid,producttitle,sort,model,thumbNail from Product where categoryid in (select categoryid from Category where companyid=16) order by sort ", conn);
            adpDB.Fill(dtDB);
        }
        else
        {
            SqlDataAdapter adpDB = new SqlDataAdapter("Select  productid,producttitle,sort,model,thumbNail from Product where categoryid in (select categoryid from Category where companyid=16 and categoryid=" + Request.QueryString["categoryid"] + ") order by sort ", conn);
            adpDB.Fill(dtDB);
        }

        PagedDataSource objPage = new PagedDataSource();
        objPage.DataSource = dtDB.DefaultView;
        objPage.AllowPaging = true;
        objPage.PageSize = 100;
        Session["TotalPages"] = objPage.PageCount - 1;
        objPage.CurrentPageIndex = CurrentPage;

        DataList1.DataSource = objPage;
        DataList1.DataBind();
        conn.Close();
    }
开发者ID:asgharlatif,项目名称:HSSWebSite,代码行数:32,代码来源:productviewgallery.aspx.cs


示例16: Bind_Msg

    protected void Bind_Msg()
    {
        String strCount = "0";
        String strCmd = "SELECT * FROM MsgBrd where Status = true order by CreateTime desc";
        DataTable dt = AccessHelper.ExecuteDataTable(spbtzb.ConString.ConnString, CommandType.Text, strCmd);
        if (dt == null || dt.Rows.Count == 0)
        {
            return;
        }

        this.lbl_Count.Text = dt.Rows.Count.ToString();
        dvbtn.Visible = true;
        PagedDataSource ps = new PagedDataSource();
        ps.AllowPaging = true;
        ps.PageSize = 15;
        ps.CurrentPageIndex = Convert.ToInt32(this.lbCurPage.Text) - 1;
        ps.DataSource = dt.DefaultView;
        rp_Msgs.DataSource = ps;
        this.btnPreviousPage.Enabled = true;
        this.btnNextPage.Enabled = true;
        if (ps.CurrentPageIndex == 0)
        {
            this.btnPreviousPage.Enabled = false;
        }
        if (ps.CurrentPageIndex == ps.PageCount - 1)
        {
            this.btnNextPage.Enabled = false;
        }
        this.rp_Msgs.DataBind();
    }
开发者ID:dalinhuang,项目名称:cqwz,代码行数:30,代码来源:MsgBrd.aspx.cs


示例17: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        dtNewsCategory = taNewsCategory.SelectNewsCategoryNameByNewsCategoryId(5);
            if (dtNewsCategory.Rows.Count > 0)
            {
                int page = 10;

                dtNews = taNews.SelectNewsbyNewsCategoryId(5);
                if (dtNews.Rows.Count > 0)
                {
                    PagedDataSource objPds = new PagedDataSource();
                    objPds.DataSource = dtNews.DefaultView;
                    objPds.AllowPaging = true;
                    objPds.PageSize = page;
                    objPds.CurrentPageIndex = CurrentPage;
                    Repeater1.DataSource = objPds;
                    Repeater1.DataBind();
                }
                else
                {
                    Repeater1.Visible = false;
                }
            }
            else
            {
                Repeater1.Visible = false;
            }
    }
开发者ID:asgharlatif,项目名称:HSSWebSite,代码行数:28,代码来源:Default.aspx.cs


示例18: EP

    EP ep = new EP(); //实例化一个对象

    #endregion Fields

    #region Methods

    public void bindDataList()
    {
        int curpage = Convert.ToInt32(this.labPage.Text);
        PagedDataSource ps = new PagedDataSource();
        SqlConnection con = new SqlConnection(EP.GetConStr());
        con.Open();
        string sqlstr = "select * from tb_tools";
        SqlDataAdapter MyAdapter = new SqlDataAdapter(sqlstr, con);
        DataSet ds = new DataSet();
        MyAdapter.Fill(ds, "tb_tools");
        ps.DataSource = ds.Tables["tb_tools"].DefaultView;
        ps.AllowPaging = true; //是否可以分页
        ps.PageSize = 2; //显示的数量
        ps.CurrentPageIndex = curpage - 1; //取得当前页的页码
        this.lnkbtnUp.Enabled = true;
        this.lnkbtnNext.Enabled = true;
        this.lnkbtnBack.Enabled = true;
        this.lnkbtnOne.Enabled = true;
        if (curpage == 1)
        {
            this.lnkbtnOne.Enabled = false;//不显示第一页按钮
            this.lnkbtnUp.Enabled = false;//不显示上一页按钮
        }
        if (curpage == ps.PageCount)
        {
            this.lnkbtnNext.Enabled = false;//不显示下一页
            this.lnkbtnBack.Enabled = false;//不显示最后一页
        }
        this.labBackPage.Text = Convert.ToString(ps.PageCount);
        this.dlContent.DataSource = ps;
        this.dlContent.DataKeyField = "ID";
        this.dlContent.DataBind();
        con.Close();
    }
开发者ID:kinggod,项目名称:21SourceCode,代码行数:40,代码来源:More_Soft.aspx.cs


示例19: BindRepeater

    private void BindRepeater()
    {
        this.cmd.CommandText = "SELECT ForumPersonalMessages.MessageID, ForumUsers.UserName, ForumPersonalMessages.CreationDate, ForumPersonalMessages.Body, ForumUsers.UserID FROM ForumPersonalMessages INNER JOIN ForumUsers ON ForumPersonalMessages.ToUserID=ForumUsers.UserID WHERE ForumPersonalMessages.FromUserID='" + CurrentUserID + "' ORDER BY ForumPersonalMessages.CreationDate DESC";

            DbDataAdapter da = providerFactory.CreateDataAdapter();
            da.SelectCommand = this.cmd;
            DataTable dt = new DataTable();
            da.Fill(dt);
            PagedDataSource pagedSrc = new PagedDataSource();
            pagedSrc.DataSource = dt.DefaultView;
            pagedSrc.AllowPaging = true;
            pagedSrc.PageSize = this.pageSize;
            int curPage = 0;
            if(Request.QueryString["page"]!=null)
                int.TryParse(Request.QueryString["page"], out curPage);
            pagedSrc.CurrentPageIndex = curPage;

            //prepare a string for the "pager" at the bottom
            pagerString = "";
            for (int i = 0; i < pagedSrc.PageCount; i++)
            {
                if (i == curPage)
                    pagerString += " " + (i + 1);
                else
                    pagerString += " <a href=\"privatemessages.aspx?Page=" + i + "\">" + (i + 1) + "</a>";
            }

            this.rptMessagesList.DataSource = pagedSrc;
            this.rptMessagesList.DataBind();
    }
开发者ID:VirtusStudio,项目名称:Tri-Living-Well,代码行数:30,代码来源:privatesent.aspx.cs


示例20: GWbind

    //绑定main文章
    public void GWbind()
    {
        int curpage = Convert.ToInt32(this.labPage.Text);
        PagedDataSource ps = new PagedDataSource();
        //conn.Open();
        string sql = "select * from tb_PostMsg  order by ID DESC";
        SqlDataAdapter da = new SqlDataAdapter(sql, conn);
        da.Fill(ds, "tb_PostMsg");
        ps.DataSource = ds.Tables["tb_PostMsg"].DefaultView;
        //ps.DataSource = sh.GetDataSet(sql, "PostMsg");
        ps.AllowPaging = true; //是否可以分页
        ps.PageSize = 15; //显示的数量
        ps.CurrentPageIndex = curpage - 1; //取得当前页的页码
        this.lnkbtnUp.Enabled = true;
        this.lnkbtnNext.Enabled = true;
        this.lnkbtnBack.Enabled = true;
        this.lnkbtnOne.Enabled = true;
        if (curpage == 1)
        {
            this.lnkbtnOne.Enabled = false;//不显示第一页按钮
            this.lnkbtnUp.Enabled = false;//不显示上一页按钮
        }

        if (curpage == ps.PageCount)
        {
            this.lnkbtnNext.Enabled = false;//不显示下一页
            this.lnkbtnBack.Enabled = false;//不显示最后一页
        }
        this.labBackPage.Text = Convert.ToString(ps.PageCount);
        this.GridView1.DataSource = ps;
        this.GridView1.DataBind();
        //conn.Close();
    }
开发者ID:JohnToCoder,项目名称:MusicShop,代码行数:34,代码来源:BBS.aspx.cs



注:本文中的PagedDataSource类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# PagedList类代码示例发布时间:2022-05-24
下一篇:
C# PageType类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap