Esempio n. 1
0
    //加载数据记录
    private void LoadData(string sql)
    {
        SqlConnection con = SystemMgr.BLL.Common.getConnection();

        con.Open();
        SqlDataAdapter sda = new SqlDataAdapter(sql, con);
        DataSet        ds  = new DataSet();

        sda.Fill(ds);

        lab_all_count.Text = ds.Tables[0].Rows.Count.ToString();
        if (ds.Tables[0].Rows.Count == 0)
        {
            trFenye.Visible = false;
        }
        else
        {
            trFenye.Visible = true;
        }


        PagedDataSource objPds = new PagedDataSource();

        objPds.DataSource = ds.Tables[0].DefaultView;

        objPds.AllowPaging = true;
        objPds.PageSize    = 39;

        int CurPage;

        if (Request.QueryString["Page"] != null)
        {
            CurPage = Convert.ToInt32(Request.QueryString["Page"]);
        }
        else
        {
            CurPage = 1;
        }

        objPds.CurrentPageIndex = CurPage - 1;
        lblCurrentPage.Text     = CurPage.ToString();
        lblSumPage.Text         = objPds.PageCount.ToString();

        if (!objPds.IsFirstPage)
        {
            this.hyfirst.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + 1;
            lnkPrev.NavigateUrl      = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage - 1);
        }

        if (!objPds.IsLastPage)
        {
            hylastpage.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + objPds.PageCount;

            lnkNext.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage + 1);
        }

        this.DataList1.DataSource = objPds;
        this.DataList1.DataBind();
        con.Close();
    }
Esempio n. 2
0
    private void gvbind()
    {
        string        sql = "select * from News  where TypeName='教学大纲' " + (txtkey.Text.Trim() == "" ? "" : " and [name] like '%" + txtkey.Text.Trim() + "%'") + "  order by addtime desc";
        SqlConnection con = SystemMgr.BLL.Common.getConnection();

        con.Open();
        SqlDataAdapter sda = new SqlDataAdapter(sql, con);
        DataSet        ds  = new DataSet();

        sda.Fill(ds);
        lab_all_count.Text = ds.Tables[0].Rows.Count.ToString();
        if (ds.Tables[0].Rows.Count == 0)
        {
            trFenye.Visible = false;
        }
        else
        {
            trFenye.Visible = true;
        }

        PagedDataSource objPds = new PagedDataSource();

        objPds.DataSource = ds.Tables[0].DefaultView;

        objPds.AllowPaging = true;
        objPds.PageSize    = 39;

        int CurPage;

        if (Request.QueryString["Page"] != null)
        {
            CurPage = Convert.ToInt32(Request.QueryString["Page"]);
        }
        else
        {
            CurPage = 1;
        }

        objPds.CurrentPageIndex = CurPage - 1;
        lblCurrentPage.Text     = CurPage.ToString();
        lblSumPage.Text         = objPds.PageCount.ToString();

        if (!objPds.IsFirstPage)
        {
            this.hyfirst.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + 1;
            lnkPrev.NavigateUrl      = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage - 1);
        }

        if (!objPds.IsLastPage)
        {
            hylastpage.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + objPds.PageCount;

            lnkNext.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage + 1);
        }

        this.DataList1.DataSource = objPds;
        this.DataList1.DataBind();
        con.Close();
    }
Esempio n. 3
0
    private void gvbind()
    {
        /*    string sql = "select * from News  where TypeName='" + Request.QueryString["TypeName"].ToString() + "' order by id desc";*/
        string sql;

        if (Request.QueryString["TypeName"].ToString() != "促销活动")
        {
            sql = "select * from News where TypeName!='促销活动' order by id desc";
        }
        else
        {
            sql = "select * from News  where TypeName='" + Request.QueryString["TypeName"].ToString() + "' order by id desc";
        }
        SqlConnection con = new SqlConnection(SqlHelper.connstring);

        con.Open();
        SqlDataAdapter sda = new SqlDataAdapter(sql, con);
        DataSet        ds  = new DataSet();

        sda.Fill(ds);
        PagedDataSource objPds = new PagedDataSource();

        objPds.DataSource = ds.Tables[0].DefaultView;

        objPds.AllowPaging = true;
        objPds.PageSize    = 15;

        int CurPage;

        if (Request.QueryString["Page"] != null)
        {
            CurPage = Convert.ToInt32(Request.QueryString["Page"]);
        }
        else
        {
            CurPage = 1;
        }

        objPds.CurrentPageIndex = CurPage - 1;
        lblCurrentPage.Text     = CurPage.ToString();
        lblSumPage.Text         = objPds.PageCount.ToString();

        if (!objPds.IsFirstPage)
        {
            this.hyfirst.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + 1 + "&TypeName=" + Request.QueryString["TypeName"].ToString();
            lnkPrev.NavigateUrl      = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage - 1) + "&TypeName=" + Request.QueryString["TypeName"].ToString();
        }

        if (!objPds.IsLastPage)
        {
            hylastpage.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + objPds.PageCount + "&TypeName=" + Request.QueryString["TypeName"].ToString();

            lnkNext.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage + 1) + "&TypeName=" + Request.QueryString["TypeName"].ToString();
        }

        this.DataList1.DataSource = objPds;
        this.DataList1.DataBind();
        con.Close();
    }
Esempio n. 4
0
    private void BinderReplay()
    {
        int id = int.Parse(Request.QueryString["id"].ToString());

        string        sql = "select Comment.addTime,Comment.Titles,Users.Photo,Users.UserName from Comment , Users where Comment.UserId = Users.id and Comment.ShangPinID =" + id + "ORDER BY Comment.addTime DESC ";
        SqlConnection con = new SqlConnection(SqlHelper.connstring);

        con.Open();
        SqlDataAdapter sda = new SqlDataAdapter(sql, con);
        DataSet        ds  = new DataSet();



        sda.Fill(ds);
        //PagedDataSource类封装了DataList属性,使其可以执行分页
        PagedDataSource objPds = new PagedDataSource();

        //获取或设置数据源
        objPds.DataSource = ds.Tables[0].DefaultView;

        //设置是否用分页的值
        objPds.AllowPaging = true;
        //获取或设置要在单页上显示的项数
        objPds.PageSize = 5;

        int CurPage;

        if (Request.QueryString["Page"] != null)
        {
            CurPage = Convert.ToInt32(Request.QueryString["Page"]);
        }
        else
        {
            CurPage = 1;
        }
        //获取或设置当前页的索引
        objPds.CurrentPageIndex = CurPage - 1;
        lblCurrentPage.Text     = CurPage.ToString();
        //显示数据源中所有项所需要的总页数
        lblSumPage.Text = objPds.PageCount.ToString();
        //获取一个值,判断当前页是否是首页
        if (!objPds.IsFirstPage)
        {
            this.hyfirst.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + 1 + "&id=" + id;
            lnkPrev.NavigateUrl      = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage - 1) + "&id=" + id;
        }
        //获取一个值,判断当前页是最后一页
        if (!objPds.IsLastPage)
        {
            hylastpage.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + objPds.PageCount + "&id=" + id;

            lnkNext.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage + 1) + "&id=" + id;
        }

        this.DataList2.DataSource = objPds;
        this.DataList2.DataBind();

        con.Close();
    }
Esempio n. 5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["Admin_Level"] == null || Session["NOPRUserID"] == null)
        {
            Server.Transfer("Login.aspx");
        }
        else
        {
            //读取数据

            DataSet        ds  = new DataSet();
            SqlDataAdapter sda = new SqlDataAdapter("select * from NOPR_User", SqlHelper.Conn);
            sda.Fill(ds, "User");
            PagedDataSource pds = new PagedDataSource();
            pds.DataSource  = ds.Tables["User"].DefaultView;
            pds.AllowPaging = true; //允许分页
            pds.PageSize    = 10;   //单页显示项数
            int CurPage;
            if (Request.QueryString["Page"] != null)
            {
                CurPage = Convert.ToInt32(Request.QueryString["Page"]);
            }
            else
            {
                CurPage = 1;
            }
            pds.CurrentPageIndex = CurPage - 1;
            int Count = pds.PageCount;
            lblCurrentPage.Text = "Current Page:" + CurPage.ToString();
            labPage.Text        = Count.ToString();
            if (Count > 1)
            {
                this.first.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=1";
                this.last.NavigateUrl  = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(Count);
            }

            if (!pds.IsFirstPage)
            {
                up.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage - 1);
            }

            if (!pds.IsLastPage)
            {
                next.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage + 1);
            }


            //Repeater
            User.DataSource = pds;
            User.DataBind();

            if (!IsPostBack)
            {
                Level.Items.Clear();
                Level.Items.Add("Admin");
                Level.Items.Add("User");
            }
        }
    }
Esempio n. 6
0
        private void CreatePageNum()
        {
            int  maxpage, minpage;
            int  js      = 5;
            bool haspre  = false;
            bool hasnext = false;

            if (CurPage < js)
            {
                minpage = 1;
                maxpage = TotalPage >= js + 2 ? js + 2 : TotalPage;
                if (TotalPage >= js + 2)
                {
                    hasnext = true;
                }
            }
            else
            {
                //if (CurPage % 10 == 0)
                //{
                //    minpage = CurPage - 9;
                //    maxpage = CurPage;
                //}
                //else
                //{
                haspre  = true;
                minpage = CurPage - 3;
                if (CurPage + 3 > TotalPage)
                {
                    maxpage = TotalPage;
                }
                else
                {
                    maxpage = CurPage + 3;
                    hasnext = true;
                }
                //}
            }
            if (haspre)
            {
                str.Append(" ...");
            }
            for (int i = minpage; i <= maxpage; i++)
            {
                if (i == CurPage)
                {
                    str.Append(" <a class=\"cur\">" + CurPage.ToString() + "</a>");
                }
                else
                {
                    str.Append(" <a href=\"" + BuildUrlString("p", i.ToString()) + "\">" + i + "</a>");
                }
            }
            if (hasnext)
            {
                str.Append(" ...");
            }
        }
    /// <summary>
    ///
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString["colose"] != null)
        {
            if (Request.QueryString["colose"].ToString() == "1" && Request.QueryString["id"] != null)
            {
                utils.ExecuteNonQuery("UPDATE TT_Question SET state=1 WHERE ID=" + Request.QueryString["id"]);
            }
        }
        if (!IsPostBack)
        {
            DataTable dt = utils.ExecuteDataTable("SELECT * FROM TT_Question WHERE LV=1 ORDER BY id DESC ");
            dt.Columns.Add("count");
            dt = getCount(dt);

            PagedDataSource objPds = new PagedDataSource();
            //设置分页控件数据
            objPds.DataSource  = dt.DefaultView;
            objPds.AllowPaging = true;
            objPds.PageSize    = 8;

            if (dt != null && dt.Rows.Count > 0)
            {
                lbcountPage.Text = objPds.PageCount.ToString();
            }
            int CurPage;
            if (Request.QueryString["Page"] != null)
            {
                CurPage = Convert.ToInt32(Request.QueryString["Page"]);
            }
            else
            {
                CurPage = 1;
            }


            //设置分页码
            objPds.CurrentPageIndex = CurPage - 1;
            lblCurrentPage.Text     = "当前页:" + CurPage.ToString();

            //设置下一页参数
            if (!objPds.IsFirstPage)
            {
                lnkPrev.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage - 1);
            }
            //设置上一页参数
            if (!objPds.IsLastPage)
            {
                lnkNext.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage + 1);
            }



            Repeater1.DataSource = objPds;
            Repeater1.DataBind();
        }
    }
Esempio n. 8
0
    protected void DataListDataBind()
    {
        //AccessDataSource ads = new AccessDataSource();
        //ads.DataFile = "~/date/blog_Data.mdb";
        //sql_stringchar sql_string = new sql_stringchar();//动态数据源
        //sql_string.connectionstring = sql_string.sql_char;//连接字符串
        Sql_StringChar sql_String = new Sql_StringChar();  //动态数据源

        sql_String.ConnectionString = sql_String.sql_char; //连接字符串
        GetCa_id();
        sql_String.SelectCommand = "SELECT * FROM [blogMessages] where ca_id=" + ca_id + " ";
        DataView        dv      = (DataView)sql_String.Select(DataSourceSelectArguments.Empty);
        PagedDataSource objPage = new PagedDataSource();

        objPage.DataSource  = dv;
        objPage.AllowPaging = true;
        objPage.PageSize    = 3;
        int TolPage;

        TolPage = objPage.PageCount;
        int CurPage;

        if (Request.QueryString["Page"] != null)
        {
            CurPage = Convert.ToInt32(Request.QueryString["Page"]);
        }
        else
        {
            CurPage = 1;
        }
        objPage.CurrentPageIndex = CurPage - 1;
        pagenum.Text             = CurPage.ToString();
        pagecount.Text           = objPage.PageCount + "";
        lnkFirst.NavigateUrl     = Request.CurrentExecutionFilePath + "?Page=1" + "&PageSize=" + Convert.ToString(objPage.PageSize);
        lnkLast.NavigateUrl      = Request.CurrentExecutionFilePath + "?Page=" + TolPage.ToString() + "&PageSize=" + Convert.ToString(objPage.PageSize);
        if (!objPage.IsFirstPage)
        {
            lnkPrev.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage - 1) + "&PageSize=" + Convert.ToString(objPage.PageSize);
        }
        else
        {
            lnkPrev.Visible  = false;
            lnkFirst.Visible = false;
        }
        if (!objPage.IsLastPage)
        {
            lnkNext.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage + 1) + "&PageSize=" + Convert.ToString(objPage.PageSize);
        }
        else
        {
            lnkNext.Visible = false;
            lnkLast.Visible = false;
        }

        DataList2.DataSource = objPage;
        DataList2.DataBind();
    }
Esempio n. 9
0
    /// <summary>
    /// 绑定repeater
    /// </summary>
    private void BindRepeater()
    {
        string  condition = "";
        string  sql       = "select row_number() over(order by id  ) as rowid,id ,city,deptname from deptinfo order by id desc";
        DataSet ds        = DirectDataAccessor.QueryForDataSet(sql);

        try
        {
            PagedDataSource objPage = new PagedDataSource();
            objPage.DataSource  = ds.Tables[0].DefaultView;
            objPage.AllowPaging = true;
            objPage.PageSize    = 10;
            int CurPage;
            if (Request.QueryString["Page"] != null)
            {
                CurPage = Convert.ToInt32(Request.QueryString["page"]);
            }
            else
            {
                CurPage = 1;
            }
            objPage.CurrentPageIndex = CurPage - 1;
            repData.DataSource       = objPage; //这里更改控件名称
            repData.DataBind();                 //这里更改控件名称
            RecordCount.Text = objPage.DataSourceCount.ToString();
            PageCount.Text   = objPage.PageCount.ToString();
            Pageindex.Text   = CurPage.ToString();
            Literal1.Text    = PageList(objPage.PageCount, CurPage, condition);

            FirstPage.NavigateUrl = Request.CurrentExecutionFilePath + "?page=1" + condition;
            PrevPage.NavigateUrl  = Request.CurrentExecutionFilePath + "?page=" + (CurPage - 1) + condition;
            NextPage.NavigateUrl  = Request.CurrentExecutionFilePath + "?page=" + (CurPage + 1) + condition;
            LastPaeg.NavigateUrl  = Request.CurrentExecutionFilePath + "?page=" + objPage.PageCount.ToString() + condition;
            if (CurPage <= 1 && objPage.PageCount <= 1)
            {
                FirstPage.NavigateUrl = "";
                PrevPage.NavigateUrl  = "";
                NextPage.NavigateUrl  = "";
                LastPaeg.NavigateUrl  = "";
            }
            if (CurPage <= 1 && objPage.PageCount > 1)
            {
                FirstPage.NavigateUrl = "";
                PrevPage.NavigateUrl  = "";
            }
            if (CurPage >= objPage.PageCount)
            {
                NextPage.NavigateUrl = "";
                LastPaeg.NavigateUrl = "";
            }
        }
        catch (Exception error)
        {
            Response.Write(error.ToString());
        }
    }
Esempio n. 10
0
    private void UsersBind(List <zs.Model.Tbl_Message> userList, int pageSize)//repeater分页并绑定
    {
        try
        {
            PagedDataSource objPage = new PagedDataSource();
            objPage.DataSource  = userList;
            objPage.AllowPaging = true;
            objPage.PageSize    = pageSize;
            int CurPage;
            if (Request.QueryString["page"] != null)
            {
                CurPage = Convert.ToInt32(Request.QueryString["page"]);
            }
            else
            {
                CurPage = 1;
            }
            objPage.CurrentPageIndex = CurPage - 1;
            Repeater1.DataSource     = objPage;
            Repeater1.DataBind();
            RecordCount.Text = objPage.DataSourceCount.ToString();
            PageCount.Text   = objPage.PageCount.ToString();
            Pageindex.Text   = CurPage.ToString();
            Literal1.Text    = PageList(objPage.PageCount, CurPage);

            FirstPage.NavigateUrl = Request.CurrentExecutionFilePath + "?page=1";
            PrevPage.NavigateUrl  = Request.CurrentExecutionFilePath + "?page=" + (CurPage - 1);
            NextPage.NavigateUrl  = Request.CurrentExecutionFilePath + "?page=" + (CurPage + 1);
            LastPaeg.NavigateUrl  = Request.CurrentExecutionFilePath + "?page=" + objPage.PageCount.ToString();
            if (CurPage <= 1 && objPage.PageCount <= 1)
            {
                FirstPage.NavigateUrl = "";
                PrevPage.NavigateUrl  = "";
                NextPage.NavigateUrl  = "";
                LastPaeg.NavigateUrl  = "";
            }
            if (CurPage <= 1 && objPage.PageCount > 1)
            {
                FirstPage.NavigateUrl = "";
                PrevPage.NavigateUrl  = "";
            }
            if (CurPage >= objPage.PageCount)
            {
                NextPage.NavigateUrl = "";
                LastPaeg.NavigateUrl = "";
            }
        }
        catch (Exception error)
        {
            Response.Write(error.ToString());
        }
        finally
        {
        }
    }
    private void gvbind()
    {
        string sqlstr = "";

        sqlstr = "select  * from ShangPinInfo order by ShangPinDate desc ";
        SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);

        con.Open();

        SqlDataAdapter sda = new SqlDataAdapter(sqlstr, con);

        DataSet ds = new DataSet();

        sda.Fill(ds);
        PagedDataSource objPds = new PagedDataSource();

        objPds.DataSource = ds.Tables[0].DefaultView;

        objPds.AllowPaging = true;
        objPds.PageSize    = 16;

        int CurPage;

        if (Request.QueryString["Page"] != null)
        {
            CurPage = Convert.ToInt32(Request.QueryString["Page"]);
        }
        else
        {
            CurPage = 1;
        }

        objPds.CurrentPageIndex = CurPage - 1;
        lblCurrentPage.Text     = CurPage.ToString();
        lblSumPage.Text         = objPds.PageCount.ToString();

        if (!objPds.IsFirstPage)
        {
            this.hyfirst.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + 1;
            lnkPrev.NavigateUrl      = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage - 1);
        }

        if (!objPds.IsLastPage)
        {
            hylastpage.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + objPds.PageCount;

            lnkNext.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage + 1);
        }

        this.DataList1.DataSource = objPds;
        this.DataList1.DataBind();
        con.Close();
    }
Esempio n. 12
0
    private void BinderReplay()
    {
        int id = Convert.ToInt32(Session["UserId"]);
        /* string sql = "select * from  Comment where ShangPinId=" + id;*/

        string        sql = "select ShangPinInfo.* ,ShoppingCart.* from  ShangPinInfo,ShoppingCart where ShoppingCart.userid='" + id + "'and ShangPinInfo.ShangPinID = ShoppingCart.pid ORDER BY ShoppingCart.shoutime DESC";
        SqlConnection con = new SqlConnection(SqlHelper.connstring);

        con.Open();
        SqlDataAdapter sda = new SqlDataAdapter(sql, con);
        DataSet        ds  = new DataSet();

        sda.Fill(ds);
        PagedDataSource objPds = new PagedDataSource();

        objPds.DataSource = ds.Tables[0].DefaultView;

        objPds.AllowPaging = true;
        objPds.PageSize    = 5;

        int CurPage;

        if (Request.QueryString["Page"] != null)
        {
            CurPage = Convert.ToInt32(Request.QueryString["Page"]);
        }
        else
        {
            CurPage = 1;
        }

        objPds.CurrentPageIndex = CurPage - 1;
        lblCurrentPage.Text     = CurPage.ToString();
        lblSumPage.Text         = objPds.PageCount.ToString();

        if (!objPds.IsFirstPage)
        {
            this.hyfirst.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + 1 + "&id=" + id;
            lnkPrev.NavigateUrl      = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage - 1) + "&id=" + id;
        }

        if (!objPds.IsLastPage)
        {
            hylastpage.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + objPds.PageCount + "&id=" + id;

            lnkNext.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage + 1) + "&id=" + id;
        }

        this.DataList1.DataSource = objPds;
        this.DataList1.DataBind();
        con.Close();
    }
Esempio n. 13
0
    private void GetListPage()
    {
        try
        {
            SqlConnection con = new SqlConnection(SqlHelper.connstring);

            con.Open();
            SqlDataAdapter sda = new SqlDataAdapter("select  * from  shangpin order by GoodsDate desc ", con);


            DataSet ds = new DataSet();
            sda.Fill(ds);
            PagedDataSource objPds = new PagedDataSource();
            objPds.DataSource = ds.Tables[0].DefaultView;

            objPds.AllowPaging = true;
            objPds.PageSize    = 12;

            int CurPage;
            if (Request.QueryString["Page"] != null)
            {
                CurPage = Convert.ToInt32(Request.QueryString["Page"]);
            }
            else
            {
                CurPage = 1;
            }

            objPds.CurrentPageIndex = CurPage - 1;
            lblCurrentPage.Text     = CurPage.ToString();
            lblSumPage.Text         = objPds.PageCount.ToString();

            if (!objPds.IsFirstPage)
            {
                this.hyfirst.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + 1;
                lnkPrev.NavigateUrl      = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage - 1);
            }

            if (!objPds.IsLastPage)
            {
                hylastpage.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + objPds.PageCount;

                lnkNext.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage + 1);
            }
            dlGoods.DataSource = objPds;
            dlGoods.DataBind();
        }
        catch
        {
        }
    }
Esempio n. 14
0
    private void gvbind()
    {
        string        sql = " select * , dbo.f_GetPy(left(name,1)) as SZM  from Music  where  IsCheck='1' and  dbo.f_GetPy(left(name,1))='" + Request.QueryString["key"].ToString() + "'";
        SqlConnection con = new SqlConnection(SqlHelper.connstring);

        con.Open();

        SqlDataAdapter sda = new SqlDataAdapter(sql, con);

        DataSet ds = new DataSet();

        sda.Fill(ds);
        PagedDataSource objPds = new PagedDataSource();

        objPds.DataSource = ds.Tables[0].DefaultView;

        objPds.AllowPaging = true;
        objPds.PageSize    = 16;

        int CurPage;

        if (Request.QueryString["Page"] != null)
        {
            CurPage = Convert.ToInt32(Request.QueryString["Page"]);
        }
        else
        {
            CurPage = 1;
        }

        objPds.CurrentPageIndex = CurPage - 1;
        lblCurrentPage.Text     = CurPage.ToString();
        lblSumPage.Text         = objPds.PageCount.ToString();

        if (!objPds.IsFirstPage)
        {
            this.hyfirst.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + 1 + "&key=" + Request.QueryString["key"].ToString();
            lnkPrev.NavigateUrl      = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage - 1) + "&key=" + Request.QueryString["key"].ToString();
        }

        if (!objPds.IsLastPage)
        {
            hylastpage.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + objPds.PageCount + "&key=" + Request.QueryString["key"].ToString();

            lnkNext.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage + 1) + "&key=" + Request.QueryString["key"].ToString();
        }

        this.DataList1.DataSource = objPds;
        this.DataList1.DataBind();
        con.Close();
    }
Esempio n. 15
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["Manage_Level"] == null || Session["UserID"] == null || Session["Receipt"] == null)
        {
            Server.Transfer("Login.aspx");
        }
        else
        {
            //读取数据
            SqlConnection  conn = new SqlConnection();
            DataSet        ds   = new DataSet();
            SqlDataAdapter sda  = new SqlDataAdapter("select Trans_Value,Trans_Order from ERS_Trans where Trans_Type='Currency' order by Trans_Order", SqlHelper.Conn);
            sda.Fill(ds, "Currency");
            PagedDataSource pds = new PagedDataSource();
            pds.DataSource  = ds.Tables["Currency"].DefaultView;
            pds.AllowPaging = true; //允许分页
            pds.PageSize    = 10;   //单页显示项数
            int CurPage;
            if (Request.QueryString["Page"] != null)
            {
                CurPage = Convert.ToInt32(Request.QueryString["Page"]);
            }
            else
            {
                CurPage = 1;
            }
            pds.CurrentPageIndex = CurPage - 1;
            int Count = pds.PageCount;
            lblCurrentPage.Text = "Current Page:" + CurPage.ToString();
            labPage.Text        = Count.ToString();
            if (Count > 1)
            {
                this.first.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=1";
                this.last.NavigateUrl  = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(Count);
            }
            if (!pds.IsFirstPage)
            {
                up.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage - 1);
            }

            if (!pds.IsLastPage)
            {
                next.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage + 1);
            }


            //Repeater
            table.DataSource = pds;
            table.DataBind();
        }
    }
Esempio n. 16
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["staffno"] == null)
        {
            Response.Redirect("Default.aspx");
        }
        else
        {
            Label1.Text = "Welcome " + Session["staffname"].ToString();

            SqlConnection  conn = new SqlConnection();
            DataSet        ds   = new DataSet();
            SqlDataAdapter sda  = new SqlDataAdapter("select id,Position  from MSAS_Position   order by id", SqlHelper1.Conn);
            sda.Fill(ds, "Position");
            PagedDataSource pds = new PagedDataSource();
            pds.DataSource  = ds.Tables["Position"].DefaultView;
            pds.AllowPaging = true; //允许分页
            pds.PageSize    = 10;   //单页显示项数
            int CurPage;
            if (Request.QueryString["Page"] != null)
            {
                CurPage = Convert.ToInt32(Request.QueryString["Page"]);
            }
            else
            {
                CurPage = 1;
            }
            pds.CurrentPageIndex = CurPage - 1;
            int Count = pds.PageCount;
            lblCurrentPage.Text = "Current Page:" + CurPage.ToString();
            labPage.Text        = Count.ToString();
            if (Count > 1)
            {
                this.first.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=1";
                this.last.NavigateUrl  = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(Count);
            }
            if (!pds.IsFirstPage)
            {
                up.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage - 1);
            }

            if (!pds.IsLastPage)
            {
                next.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage + 1);
            }
            //Repeater
            Position_table.DataSource = pds;
            Position_table.DataBind();
        }
    }
Esempio n. 17
0
    private void gvbind()
    {
        //这里获取教练信息的列表,每页显示十五条教练
        string        sql = "select * from JiaoLian   order by Click desc";
        SqlConnection con = new SqlConnection(SqlHelper.connstring);

        con.Open();
        SqlDataAdapter sda = new SqlDataAdapter(sql, con);
        DataSet        ds  = new DataSet();

        sda.Fill(ds);
        PagedDataSource objPds = new PagedDataSource();

        objPds.DataSource = ds.Tables[0].DefaultView;

        objPds.AllowPaging = true;
        objPds.PageSize    = 15;

        int CurPage;

        if (Request.QueryString["Page"] != null)
        {
            CurPage = Convert.ToInt32(Request.QueryString["Page"]);
        }
        else
        {
            CurPage = 1;
        }

        objPds.CurrentPageIndex = CurPage - 1;
        lblCurrentPage.Text     = CurPage.ToString();
        lblSumPage.Text         = objPds.PageCount.ToString();

        if (!objPds.IsFirstPage)
        {
            this.hyfirst.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + 1;
            lnkPrev.NavigateUrl      = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage - 1);
        }

        if (!objPds.IsLastPage)
        {
            hylastpage.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + objPds.PageCount;

            lnkNext.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage + 1);
        }

        this.DataList1.DataSource = objPds;
        this.DataList1.DataBind();
        con.Close();
    }
Esempio n. 18
0
    private void BinderReplay()
    {
        int           id  = Int16.Parse(Request.QueryString["id"].ToString());
        string        sql = "select * from  Replay where TopicId=" + id;
        SqlConnection con = new SqlConnection(SqlHelper.connstring);

        con.Open();
        SqlDataAdapter sda = new SqlDataAdapter(sql, con);
        DataSet        ds  = new DataSet();

        sda.Fill(ds);
        PagedDataSource objPds = new PagedDataSource();

        objPds.DataSource = ds.Tables[0].DefaultView;

        objPds.AllowPaging = true;
        objPds.PageSize    = 5;

        int CurPage;

        if (Request.QueryString["Page"] != null)
        {
            CurPage = Convert.ToInt32(Request.QueryString["Page"]);
        }
        else
        {
            CurPage = 1;
        }

        objPds.CurrentPageIndex = CurPage - 1;
        lblCurrentPage.Text     = CurPage.ToString();
        lblSumPage.Text         = objPds.PageCount.ToString();

        if (!objPds.IsFirstPage)
        {
            this.hyfirst.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + 1 + "&id=" + id;
            lnkPrev.NavigateUrl      = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage - 1) + "&id=" + id;
        }

        if (!objPds.IsLastPage)
        {
            hylastpage.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + objPds.PageCount + "&id=" + id;

            lnkNext.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage + 1) + "&id=" + id;
        }

        this.DataList1.DataSource = objPds;
        this.DataList1.DataBind();
        con.Close();
    }
Esempio n. 19
0
    private void gvbind()
    {
        //下面的代码是获取通用的信息并实现配合DATALIST控件进行分页显示的 代码
        string        sql = "select * from dbo.QiCai   order by id asc";
        SqlConnection con = new SqlConnection(SqlHelper.connstring);

        con.Open();
        SqlDataAdapter sda = new SqlDataAdapter(sql, con);
        DataSet        ds  = new DataSet();

        sda.Fill(ds);
        PagedDataSource objPds = new PagedDataSource();

        objPds.DataSource = ds.Tables[0].DefaultView;

        objPds.AllowPaging = true;
        objPds.PageSize    = 9;

        int CurPage;

        if (Request.QueryString["Page"] != null)
        {
            CurPage = Convert.ToInt32(Request.QueryString["Page"]);
        }
        else
        {
            CurPage = 1;
        }

        objPds.CurrentPageIndex = CurPage - 1;
        HyperLink1.Text         = "当前页:" + CurPage.ToString();
        lblSumPage.Text         = "共:" + objPds.PageCount.ToString();

        if (!objPds.IsFirstPage)
        {
            this.hyfirst.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + 1;
            lnkPrev.NavigateUrl      = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage - 1);
        }

        if (!objPds.IsLastPage)
        {
            hylastpage.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + objPds.PageCount;

            lnkNext.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage + 1);
        }

        this.DataList2.DataSource = objPds;
        this.DataList2.DataBind();
        con.Close();
    }
Esempio n. 20
0
        private void pagingLoal()
        {
            try
            {
                PagedDataSource objPds = new PagedDataSource();
                if (ddlViewSubCategory.SelectedValue == "")
                {
                    objPds.DataSource = cockBLL.GetCocktail(0, 0);
                }
                else
                {
                    objPds.DataSource = cockBLL.GetCocktail(int.Parse(ddlViewSubCategory.SelectedValue), 0);
                }
                objPds.AllowPaging = true;
                objPds.PageSize    = 8;
                int CurPage;
                if (Request.QueryString["Page"] != null)
                {
                    CurPage = Convert.ToInt32(Request.QueryString["Page"]);
                }
                else
                {
                    CurPage = 1;
                }


                objPds.CurrentPageIndex = CurPage - 1;
                lblCurrentPage.Text     = "Page: " + CurPage.ToString();

                if (!objPds.IsFirstPage)
                {
                    lnkPrev.NavigateUrl = Request.CurrentExecutionFilePath
                                          + "?Page=" + Convert.ToString(CurPage - 1);
                }

                if (!objPds.IsLastPage)
                {
                    lnkNext.NavigateUrl = Request.CurrentExecutionFilePath
                                          + "?Page=" + Convert.ToString(CurPage + 1);
                }

                RptMainHead.DataSource = objPds;
                RptMainHead.DataBind();
            }
            catch (Exception ex)
            {
                Show(ex.Message);
            }
        }
Esempio n. 21
0
    public void getdata()
    {
        //读取数据
        SqlConnection  conn = new SqlConnection();
        DataSet        ds   = new DataSet();
        SqlDataAdapter sda  = new SqlDataAdapter("select StaffID,Name,Result,Punch_Date,Punch_Time,Email,GM_Email,Other_Email  from NOPR_Data where 1=1", SqlHelper.Conn);

        sda.Fill(ds, "Email_table");
        PagedDataSource pds = new PagedDataSource();

        pds.DataSource  = ds.Tables["Email_table"].DefaultView;
        datacount.Text  = ds.Tables["Email_table"].Rows.Count.ToString();
        pds.AllowPaging = true; //允许分页
        pds.PageSize    = 5;    //单页显示项数
        int CurPage;

        if (Request.QueryString["Page"] != null)
        {
            CurPage = Convert.ToInt32(Request.QueryString["Page"]);
        }
        else
        {
            CurPage = 1;
        }
        pds.CurrentPageIndex = CurPage - 1;
        int Count = pds.PageCount;

        lblCurrentPage.Text = "Current Page:" + CurPage.ToString();
        labPage.Text        = Count.ToString();
        if (Count > 1)
        {
            this.first.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=1";
            this.last.NavigateUrl  = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(Count);
        }
        if (!pds.IsFirstPage)
        {
            up.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage - 1);
        }

        if (!pds.IsLastPage)
        {
            next.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage + 1);
        }


        //Repeater
        Email_table.DataSource = pds;
        Email_table.DataBind();
    }
Esempio n. 22
0
    public void getdate(string Station)
    {
        //读取数据
        SqlConnection  conn = new SqlConnection();
        DataSet        ds   = new DataSet();
        SqlDataAdapter sda  = new SqlDataAdapter("select Trans_Value,Trans_Order from ERS_Trans where Trans_Type='Currency' and Trans_Station='" + Station + "' order by Trans_Order", SqlHelper.Conn);

        sda.Fill(ds, "Currency");
        PagedDataSource pds = new PagedDataSource();

        pds.DataSource  = ds.Tables["Currency"].DefaultView;
        pds.AllowPaging = true; //允许分页
        pds.PageSize    = 10;   //单页显示项数
        int CurPage;

        if (Request.QueryString["Page"] != null)
        {
            CurPage = Convert.ToInt32(Request.QueryString["Page"]);
        }
        else
        {
            CurPage = 1;
        }
        pds.CurrentPageIndex = CurPage - 1;
        int Count = pds.PageCount;

        lblCurrentPage.Text = "Current Page:" + CurPage.ToString();
        labPage.Text        = Count.ToString();
        if (Count > 1)
        {
            this.first.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=1";
            this.last.NavigateUrl  = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(Count);
        }
        if (!pds.IsFirstPage)
        {
            up.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage - 1);
        }

        if (!pds.IsLastPage)
        {
            next.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage + 1);
        }


        //Repeater
        table.DataSource = pds;
        table.DataBind();
    }
        protected void LinkButton_Inovice(object sender, CommandEventArgs e)
        {
            var data = SaleBLL.BranchWise_SalesInfoLaod_ChangeProduct(int.Parse(e.CommandArgument.ToString()), 0, "", "", "", "", "");

            if (data.Count > 0)
            {
                //  HFMemberId.Value = e.CommandArgument.ToString();
                // ddlMember.SelectedValue = e.CommandArgument.ToString();
                HFDate.Value = data.First().CreateDate.ToShortDateString();
                PagedDataSource objPds = new PagedDataSource();
                objPds.DataSource  = data;
                objPds.AllowPaging = true;
                objPds.PageSize    = 8;
                int CurPage;
                if (Request.QueryString["Page"] != null)
                {
                    CurPage = Convert.ToInt32(Request.QueryString["Page"]);
                }
                else
                {
                    CurPage = 1;
                }


                objPds.CurrentPageIndex = CurPage - 1;
                lblCurrentProduct.Text  = "Page: " + CurPage.ToString();

                if (!objPds.IsFirstPage)
                {
                    lnkPrevProduct.NavigateUrl = Request.CurrentExecutionFilePath
                                                 + "?Page=" + Convert.ToString(CurPage - 1);
                }

                if (!objPds.IsLastPage)
                {
                    lnkNextProduct.NavigateUrl = Request.CurrentExecutionFilePath
                                                 + "?Page=" + Convert.ToString(CurPage + 1);
                }

                RptProduct.DataSource = objPds;
                RptProduct.DataBind();
                pnlProduct.Visible = true;
            }
            else
            {
                Show("No data!");
            }
        }
Esempio n. 24
0
        protected void LinkButton_Activity(object sender, CommandEventArgs e)
        {
            var data = SaleBLL.LoadActiveMemberDateWise(int.Parse(HFMemberId.Value), e.CommandArgument.ToString());

            if (data.Count > 0)
            {
                //  HFMemberId.Value = e.CommandArgument.ToString();
                // ddlMember.SelectedValue = e.CommandArgument.ToString();
                PagedDataSource objPds = new PagedDataSource();
                objPds.DataSource  = data;
                objPds.AllowPaging = true;
                objPds.PageSize    = 8;
                int CurPage;
                if (Request.QueryString["Page"] != null)
                {
                    CurPage = Convert.ToInt32(Request.QueryString["Page"]);
                }
                else
                {
                    CurPage = 1;
                }


                objPds.CurrentPageIndex = CurPage - 1;
                lblCurrentPage.Text     = "Page: " + CurPage.ToString();

                if (!objPds.IsFirstPage)
                {
                    lnkPrev.NavigateUrl = Request.CurrentExecutionFilePath
                                          + "?Page=" + Convert.ToString(CurPage - 1);
                }

                if (!objPds.IsLastPage)
                {
                    lnkNext.NavigateUrl = Request.CurrentExecutionFilePath
                                          + "?Page=" + Convert.ToString(CurPage + 1);
                }

                RptDetails.DataSource = objPds;
                RptDetails.DataBind();
                pnlDetails.Visible = true;
            }
            else
            {
                Show("No Activity!");
            }
        }
Esempio n. 25
0
        protected void LinkButton_Command(object sender, CommandEventArgs e)
        {
            // Show(e.CommandArgument.ToString());
            var data = SaleBLL.LoadMemberDue(int.Parse(e.CommandArgument.ToString()), 0, 0);

            if (data.Count() > 0)
            {
                ddlMember.SelectedValue = e.CommandArgument.ToString();
                PagedDataSource objPds = new PagedDataSource();
                objPds.DataSource  = data;
                objPds.AllowPaging = true;
                objPds.PageSize    = 8;
                int CurPage;
                if (Request.QueryString["Page"] != null)
                {
                    CurPage = Convert.ToInt32(Request.QueryString["Page"]);
                }
                else
                {
                    CurPage = 1;
                }


                objPds.CurrentPageIndex = CurPage - 1;
                lblCurrentPage.Text     = "Page: " + CurPage.ToString();

                if (!objPds.IsFirstPage)
                {
                    lnkPrev.NavigateUrl = Request.CurrentExecutionFilePath
                                          + "?Page=" + Convert.ToString(CurPage - 1);
                }

                if (!objPds.IsLastPage)
                {
                    lnkNext.NavigateUrl = Request.CurrentExecutionFilePath
                                          + "?Page=" + Convert.ToString(CurPage + 1);
                }

                RptPayment.DataSource = objPds;
                RptPayment.DataBind();
                pnlSale.Visible = true;
            }
            else
            {
                Show("No Unpaid Bill!");
            }
        }
Esempio n. 26
0
        private void loadRepeater()
        {
            var proc = "Select Id,UserName,Password from AppUser ";

            var dt = new DataTable();

            dt = u.ReturnTable(proc);

            var objPds      = new PagedDataSource();
            var objDataView = new DataView(dt);

            objPds.DataSource = objDataView;

            objPds.AllowPaging = true;
            objPds.PageSize    = 10;
            int CurPage;

            if (Request.QueryString["Page"] != null)
            {
                CurPage = Convert.ToInt32(Request.QueryString["Page"]);
            }
            else
            {
                CurPage = 1;
            }

            objPds.CurrentPageIndex = CurPage - 1;
            lblCurrentPage.Text     = "Page: " + CurPage.ToString();

            if (!objPds.IsFirstPage)
            {
                lnkPrev.NavigateUrl = Request.CurrentExecutionFilePath
                                      + "?Page=" + Convert.ToString(CurPage - 1);
            }

            if (!objPds.IsLastPage)
            {
                lnkNext.NavigateUrl = Request.CurrentExecutionFilePath
                                      + "?Page=" + Convert.ToString(CurPage + 1);
            }

            RptData.DataSource = objPds;
            RptData.DataBind();
        }
Esempio n. 27
0
        private void repeaters()
        {
            string id = Request["id"].ToString();

            List <Record> record = BLL.RecordBLL.GetRecordById(id);

            PagedDataSource ps = new PagedDataSource();

            ps.DataSource = record;

            if (ps == null)
            {
                Response.Write(" <script> alert( '该讨论室暂无内容! ');  location.href= 'Post.aspx?id=0 '; </script> ");
            }

            ps.AllowPaging = true;
            ps.PageSize    = 5;

            int CurPage;

            if (Request.QueryString["Page"] != null)
            {
                CurPage = Convert.ToInt32(Request.QueryString["Page"]);
            }
            else
            {
                CurPage = 1;
            }

            ps.CurrentPageIndex = CurPage - 1;
            lblCurrentPage.Text = "当前页:" + CurPage.ToString();

            if (!ps.IsFirstPage)
            {
                lnkPrev.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage - 1);
            }

            if (!ps.IsLastPage)
            {
                lnkNext.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage + 1);
            }
            Repeater1.DataSource = ps;
            Repeater1.DataBind();
        }
Esempio n. 28
0
    private void Paging()
    {
        int    CurPage;
        string pagecount = pgSource.PageCount.ToString();

        if (Request.QueryString["Page"] != null)
        {
            CurPage = Convert.ToInt32(Request.QueryString["Page"]);
        }
        else
        {
            CurPage = 1;
        }

        pgSource.CurrentPageIndex = CurPage - 1;
        Label3.Text = "第" + CurPage.ToString() + "页";

        if (!pgSource.IsFirstPage)
        {
            HyperLink2.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage - 1);
        }

        if (!pgSource.IsLastPage)
        {
            HyperLink3.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage + 1);
        }

        if (!pgSource.IsFirstPage)
        {
            HyperLink4.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=1";
        }
        if (!pgSource.IsLastPage)
        {
            HyperLink5.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + pagecount;
        }

        DataList1.DataSource = pgSource;
        DataList1.DataBind();
    }
Esempio n. 29
0
        private void repeaters()
        {
            List <User> user = BLL.UserBLL.GetAllUser();

            PagedDataSource ps = new PagedDataSource();

            ps.DataSource = user;



            ps.AllowPaging = true;
            ps.PageSize    = 10;

            int CurPage;

            if (Request.QueryString["Page"] != null)
            {
                CurPage = Convert.ToInt32(Request.QueryString["Page"]);
            }
            else
            {
                CurPage = 1;
            }

            ps.CurrentPageIndex = CurPage - 1;
            lblCurrentPage.Text = "当前页:" + CurPage.ToString();

            if (!ps.IsFirstPage)
            {
                lnkPrev.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage - 1);
            }

            if (!ps.IsLastPage)
            {
                lnkNext.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage + 1);
            }
            Repeater1.DataSource = ps;
            Repeater1.DataBind();
        }
Esempio n. 30
0
        void SearchDate()
        {
            PagedDataSource objPds = new PagedDataSource();

            objPds.DataSource  = salBLL.LoadSalesDate(txtDateFrom.Text, txtDateTo.Text);
            objPds.AllowPaging = true;
            objPds.PageSize    = 8;
            int CurPage;

            if (Request.QueryString["Page"] != null)
            {
                CurPage = Convert.ToInt32(Request.QueryString["Page"]);
            }
            else
            {
                CurPage = 1;
            }


            objPds.CurrentPageIndex = CurPage - 1;
            lblCurrentPage.Text     = "Page: " + CurPage.ToString();

            if (!objPds.IsFirstPage)
            {
                lnkPrev.NavigateUrl = Request.CurrentExecutionFilePath
                                      + "?Page=" + Convert.ToString(CurPage - 1);
            }

            if (!objPds.IsLastPage)
            {
                lnkNext.NavigateUrl = Request.CurrentExecutionFilePath
                                      + "?Page=" + Convert.ToString(CurPage + 1);
            }

            RptMainHead.DataSource = objPds;
            RptMainHead.DataBind();
            // ddlMember.SelectedValue=
        }