C# 传值分页,点下一页怎么没数据呢
代码如下:public void BingDing()
    {
        string Equipment_type = Request.QueryString["Equipment_type"];

        objPage = new PagedDataSource();
        objPage.AllowPaging = true;
        objPage.PageSize = 2;
        int curPage;
        this.objPage.DataSource= objEquipment.executeNonQuery("select * from Equipment where Equipment_type='"+Equipment_type+"'").Tables[0].DefaultView;
      
        if (Request.QueryString["page"] != null)
        {
            curPage = int.Parse(Request.QueryString["page"]);
        }
        else
        {
            curPage = 1;
        }
        objPage.CurrentPageIndex = curPage - 1;
        //如果不是首条记录
        if (!objPage.IsFirstPage)
        {
            this.HyperLink1.NavigateUrl = Request.CurrentExecutionFilePath + "?Equipment_type=" + Convert.ToString(Request.QueryString["Equipment_type"]) + "?page=" + Convert.ToString(curPage - 1);
        }
        //如果不是最后一条记录
        if (!objPage.IsLastPage)
        {
            this.HyperLink2.NavigateUrl = Request.CurrentExecutionFilePath + "?Equipment_type=" + Convert.ToString(Request.QueryString["Equipment_type"]) + "?page=" + Convert.ToString(curPage + 1);
        }
        this.Label5.Text = ""+(objPage.CurrentPageIndex+1);
        this.Label6.Text = "" + objPage.PageCount;
        this.ddlstEquipment.DataSource = objPage;
        this.ddlstEquipment.DataBind();
    }

解决方案 »

  1.   

    在你点下一页的那里把数据绑定的方法在绑定一次,
    下一页的方法()
    {
        BingDing() ;
    }
    有没有这个方法?
    要不设断点调试下看看分页的时候有数据没有
      

  2.   

    这个方法,有的,
    public partial class port_product2 : System.Web.UI.Page
    {
        CompanyEquipment objEquipment;
        PagedDataSource objPage;
        CompanyTrend objTrend;
        protected void Page_Load(object sender, EventArgs e)
        {
            string connString = ConfigurationManager.AppSettings["ConnString"].ToString() + Server.MapPath(ConfigurationManager.AppSettings["dbPath"].ToString());
            objEquipment = new CompanyEquipment(connString);
            objTrend = new CompanyTrend(connString);
            if (!IsPostBack)
            {
                BingDing();
            }
        }
        public void BingDing()
        {
            string Equipment_type = Request.QueryString["Equipment_type"];

            objPage = new PagedDataSource();
            objPage.AllowPaging = true;
            objPage.PageSize = 2;
            int curPage;
            this.objPage.DataSource= objEquipment.executeNonQuery("select * from Equipment where Equipment_type='"+Equipment_type+"'").Tables[0].DefaultView;


            if (Request.QueryString["page"] != null)
            {
                curPage = int.Parse(Request.QueryString["page"]);
            }
            else
            {
                curPage = 1;
            }
            objPage.CurrentPageIndex = curPage - 1;
            //如果不是首条记录
            if (!objPage.IsFirstPage)
            {
                this.HyperLink1.NavigateUrl = Request.CurrentExecutionFilePath + "?Equipment_type=" + Convert.ToString(Request.QueryString["Equipment_type"]) + "&?page=" + Convert.ToString(curPage - 1);
            }
            //如果不是最后一条记录
            if (!objPage.IsLastPage)
            {
                this.HyperLink2.NavigateUrl = Request.CurrentExecutionFilePath + "?Equipment_type=" + Convert.ToString(Request.QueryString["Equipment_type"]) + "&?page=" + Convert.ToString(curPage + 1);
            }
            this.Label5.Text = ""+(objPage.CurrentPageIndex+1);
            this.Label6.Text = "" + objPage.PageCount;
            this.ddlstEquipment.DataSource = objPage;
            this.ddlstEquipment.DataBind();
        }
    }现在是点击下一页没变化,
      

  3.   

    http://www.cartoonb2b.cn/Banquan_class.aspx?classid=14
    看看这个分页怎么样
      

  4.   

    呵呵....这些常用的东西最好写成DLL以后经常要用的。