Example #1
0
        private void RptBind(string where)
        {
            //显示所属的广告位
            Spread.BLL.Advertising aBll = new Spread.BLL.Advertising();
            Spread.Model.Advertising aModel = aBll.GetModel(this.pid);
            lblAdTitle.Text = "【" + aModel.Id + "】" + aModel.Title + "(" + GetAdTypeName(aModel.AdType.ToString()) + ")";

            //绑定广告条列表
            if (!int.TryParse(Request.Params["page"] as string, out this.page))
            {
                this.page = 0;
            }
            this.txtKeywords.Text = this.keywords;
            Spread.BLL.Adbanner bll = new Spread.BLL.Adbanner();
            //利用PAGEDDAGASOURCE类来分页
            PagedDataSource pg = new PagedDataSource();
            pg.DataSource = bll.GetList(where).Tables[0].DefaultView;
            pg.AllowPaging = true;
            pg.PageSize = pagesize;
            pg.CurrentPageIndex = page;
            //获得总条数
            pcount = bll.GetCount(where);
            //绑定数据
            rptList.DataSource = pg;
            rptList.DataBind();
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     bllSanPham = new SanPhamBLL();
     DataTable dtNewPhone = bllSanPham.selectSPByNew();
     PagedDataSource pdsNewPhone = new PagedDataSource();
     DataView dvNewPhone = new DataView(dtNewPhone);
     pdsNewPhone.DataSource = dvNewPhone;
     pdsNewPhone.AllowPaging = true;
     pdsNewPhone.PageSize = 4;
     NewPhone.DataSource = pdsNewPhone;
     NewPhone.DataBind();
     //
     bllSanPham = new SanPhamBLL();
     DataTable dtSmartPhone = bllSanPham.selectSPByIDPhanLoai(1);
     PagedDataSource pdsSmartPhone = new PagedDataSource();
     DataView dvSmartPhone = new DataView(dtSmartPhone);
     pdsSmartPhone.DataSource = dvSmartPhone;
     pdsSmartPhone.AllowPaging = true;
     pdsSmartPhone.PageSize = 4;
     SmartPhone.DataSource = pdsSmartPhone;
     SmartPhone.DataBind();
     //
     bllSanPham = new SanPhamBLL();
     DataTable dtPhoThong = bllSanPham.selectSPByIDPhanLoai(0);
     PagedDataSource pdsPhoThong = new PagedDataSource();
     DataView dvPhoThong = new DataView(dtPhoThong);
     pdsPhoThong.DataSource = dvPhoThong;
     pdsPhoThong.AllowPaging = true;
     pdsPhoThong.PageSize = 4;
     PhoThong.DataSource = pdsPhoThong;
     PhoThong.DataBind();
 }
        public void bindData(int pageIn, string selectWhere)
        {
            BLL.eventsTb bllevent = new BLL.eventsTb();
            List<Model.eventsTb> modevent = bllevent.GetModelList(selectWhere);

            //BLL.noveltyTb bllAdmin = new BLL.noveltyTb();
            //List<Model.noveltyTb> admins = bllAdmin.GetModelList(selectWhere);
            PagedDataSource pds = new PagedDataSource();
            pds.DataSource = modevent;
            pds.PageSize = 8;
            pds.AllowPaging = true;
            pds.CurrentPageIndex = pageIn;
            this.gvSuperAdminSeeInfo.DataSource = pds;
            this.gvSuperAdminSeeInfo.DataBind();

            int pageCount = pds.PageCount;
            StringBuilder html = new StringBuilder("");
            html.Append("<a class='pageA pageStart' href='adminSeeEvents.aspx?pageInd=0'>首页</a>");
            for (int i = 0; i < pageCount; i++)
            {
                html.Append("<a class='pageA pageNum pageA" + (i + 1).ToString() + "' href='adminSeeEvents.aspx?pageInd=" + i.ToString() + "'>" + (i + 1).ToString() + "</a>");
            }
            html.Append("<a class='pageA pageStart' href='adminSeeEvents.aspx?pageInd=" + (pageCount - 1).ToString() + "'>尾页</a>");
            this.dgvpage.InnerHtml = html.ToString();

            ScriptManager.RegisterStartupScript(searchBtn, this.GetType(), "clickPage", "clickPage(" + (pageIn + 1).ToString() + ");", true);
        }
Example #4
0
        public void fillData()
        {
            DataTable dt = newsDao.GetListSearchByYearMonth(year, month);
            PagedDataSource pgitems = new PagedDataSource();
            System.Data.DataView dv = new System.Data.DataView(dt);
            pgitems.DataSource = dv;
            pgitems.AllowPaging = true;
            pgitems.PageSize = 20;
            if (PageNumber >= pgitems.PageCount) PageNumber = 0;
            pgitems.CurrentPageIndex = PageNumber;
            if (pgitems.PageCount > 1)
            {
                rptPages.Visible = true;
                System.Collections.ArrayList pages = new System.Collections.ArrayList();
                for (int i = 0; i < pgitems.PageCount; i++)
                    pages.Add((i + 1).ToString());
                rptPages.DataSource = pages;
                rptPages.DataBind();
            }
            else
                rptPages.Visible = false;

            repeaterList.DataSource = pgitems;
            repeaterList.DataBind();
        }
 protected void LoadData()
 {
     QuiTrinhDAO qtdao = new QuiTrinhDAO();
     DataTable dt = new DataTable();
     dt = qtdao.DSQuiTrinh();
     PagedDataSource pgitems = new PagedDataSource();
     System.Data.DataView dv = new System.Data.DataView(dt);
     pgitems.DataSource = dv;
     pgitems.AllowPaging = true;
     pgitems.PageSize = 15;
     pgitems.CurrentPageIndex = PageNumber;
     if (pgitems.PageCount > 1)
     {
         rptPages.Visible = true;
         System.Collections.ArrayList pages = new System.Collections.ArrayList();
         for (int i = 0; i < pgitems.PageCount; i++)
             pages.Add((i + 1).ToString());
         rptPages.DataSource = pages;
         rptPages.DataBind();
     }
     else
         rptPages.Visible = false;
     rpTinTuc.DataSource = pgitems;
     rpTinTuc.DataBind();
 }
Example #6
0
        protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
        {
            string connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["TtNum"].ConnectionString;
            SqlConnection conn = new SqlConnection(connectionString);

            SqlDataAdapter da = new SqlDataAdapter();
            da.SelectCommand = new SqlCommand("select * from GoodSort2 where GoodSort2.GS_ID='" + DropDownList1.SelectedValue + "'", conn);
            DataSet ds = new DataSet();
            try
            {
                conn.Open();
                da.Fill(ds, "GoodSort2");
                conn.Close();
            }
            catch (SqlException e2)
            {
                Response.Write(e2.ToString());
            }
            PagedDataSource obj = new PagedDataSource();
            obj.DataSource = ds.Tables["GoodSort2"].DefaultView;
            DropDownList2.DataSource = obj;
            this.DropDownList2.DataTextField = "Sort_name";
            this.DropDownList2.DataValueField = "Sort2_ID";
            DropDownList2.DataBind();
        }
Example #7
0
        public void loadComment(int idNews)
        {
            DataTable dt = daoNews.GetListComment(idNews);
            PagedDataSource pgitems = new PagedDataSource();
            System.Data.DataView dv = new System.Data.DataView(dt);
            pgitems.DataSource = dv;
            pgitems.AllowPaging = true;
            pgitems.PageSize = 20;
            if (PageNumber >= pgitems.PageCount) PageNumber = 0;
            pgitems.CurrentPageIndex = PageNumber;
            if (pgitems.PageCount > 1)
            {
                rptPagesComment.Visible = true;
                System.Collections.ArrayList pages = new System.Collections.ArrayList();
                for (int i = 0; i < pgitems.PageCount; i++)
                    pages.Add((i + 1).ToString());
                rptPagesComment.DataSource = pages;
                rptPagesComment.DataBind();
            }
            else
                rptPagesComment.Visible = false;

            rptComment.DataSource = pgitems;
            rptComment.DataBind();

            lblNumberComment.Text = "("+ dt.Rows.Count +")";
        }
Example #8
0
        //绑定用户信息到DataList
        public void DataListBind()
        {
            UserCookiesInfo user = BllOperationAboutUser.GetUserCookiesInfo();
            DalOperationFeedBack dou = new DalOperationFeedBack();
            DataView dv = dou.FindFeedBack(user.userNo).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.dlstCETFeedback.DataSource = pds;
            this.dlstCETFeedback.DataBind();

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

            if (pds.Count > 0)
            {
                this.dlstCETFeedback.ShowFooter = false;
            }
        }
Example #9
0
 /// <summary>
 /// 绑定帖子列表 
 /// </summary>
 protected void classcard() 
 {
     string sql = "select id,aliasName,logo,userId,sendcardId,title,text,date from users inner join sendcard on id=userId where sectId=@sectId order by date desc";
     DataSet ds = MySqlHelper.GetDataSet(MySqlHelper.Conn, System.Data.CommandType.Text, sql, new MySqlParameter("@sectId", sectId));
     PagedDataSource pds = new PagedDataSource();
     pds.AllowPaging = true;
     pds.PageSize = 20;
     curPage = this.lblPageCur.Text;
     pds.DataSource = ds.Tables[0].DefaultView;
     pds.CurrentPageIndex = Convert.ToInt32(curPage) - 1;
     this.lblPageTotal.Text = pds.PageCount.ToString();
     this.Button1.Enabled = true;
     this.Button2.Enabled = true;
     if (curPage == "1")
     {
         this.Button1.Enabled = false;
     }
     if (curPage == pds.PageCount.ToString())
     {
         this.Button2.Enabled = false;
     }
     this.dl_card.DataSource = pds;
     this.dl_card.DataBind();
     this.lblMesTotal.Text = Convert.ToString(MySqlHelper.ExecuteScalar(MySqlHelper.Conn, System.Data.CommandType.Text, "select count(*) from sendcard where sectId="+sectId+""));
     //int a = pds.PageCount;
     //for (int i = 1; i <= a; i++)
     //{
     //    this.DropDownList1.Items.Add(i.ToString());
     //}
 }
        public int pcount = 0; //总条数

        #endregion Fields

        #region Methods

        public void RptBind(string strWhere)
        {
            Cms.DAL.Solutions dal = new Cms.DAL.Solutions();
            DataSet ds = dal.GetList(strWhere);
            DataView dv = ds.Tables[0].DefaultView;
            //利用PAGEDDAGASOURCE类来分页
            PagedDataSource pds = new PagedDataSource();
            AspNetPager1.RecordCount = dv.Count;
            pds.DataSource = dv;
            pds.AllowPaging = true;
            pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1;
            pds.PageSize = AspNetPager1.PageSize;
            //获得总条数
            pcount = dv.Count;
            if (this.pcount > 0)
            {
                this.lbtnDel.Enabled = true;
            }
            else
            {
                this.lbtnDel.Enabled = false;
            }
            //绑定数据
            rptList.DataSource = pds;
            rptList.DataBind();
        }
Example #11
0
 void LoadData()
 {
     string query;
     db dbc = new db();
     query = "SELECT * FROM pictures ORDER BY date DESC";
     if (Request.QueryString["sort"] == "oldest")
         query = "SELECT * FROM pictures ORDER BY date ASC";
     else if (Request.QueryString["sort"] == "byalphaup")
         query = query = "SELECT * FROM pictures ORDER BY id DESC";
     else if (Request.QueryString["sort"] == "byalphadown")
         query = query = "SELECT * FROM pictures ORDER BY id ASC";
     dbc.cmd.CommandText = query;
     SqlDataAdapter da = new SqlDataAdapter(dbc.cmd);
     DataTable dt = new DataTable();
     da.Fill(dt);
     PagedDataSource pgitems = new PagedDataSource();
     System.Data.DataView dv = new System.Data.DataView(dt);
     pgitems.DataSource = dv;
     pgitems.AllowPaging = true;
     pgitems.PageSize = 9;
     pgitems.CurrentPageIndex = PageNumber;
     if (pgitems.PageCount > 1)
     {
         rptPages.Visible = true;
         System.Collections.ArrayList pages = new System.Collections.ArrayList();
         for (int i = 0; i < pgitems.PageCount; i++)
             pages.Add((i + 1).ToString());
         rptPages.DataSource = pages;
         rptPages.DataBind();
     }
     else
         rptPages.Visible = false;
     rptContent.DataSource = pgitems;
     rptContent.DataBind();
 }
Example #12
0
 private void Bind()
 {
     PagedDataSource ps = new PagedDataSource();            
     ps.DataSource = bll.ShowAllAreafact();            
     ps.AllowPaging = true;
     ps.PageSize = 5;
     lbPage.Text = ps.PageCount.ToString();
     ps.CurrentPageIndex = currentPage;
     FirstPage.Enabled = true;
     PriorPage.Enabled = true;
     NextPage.Enabled = true;
     LastPage.Enabled = true;
     if (lbCurrentPage.Text == "1")
     {
         FirstPage.Enabled = false;
         PriorPage.Enabled = false;
     }
     if (lbCurrentPage.Text == ps.PageCount.ToString())
     {
         NextPage.Enabled = false;
         LastPage.Enabled = false;
     }
     AreafactRepeater.DataSource = ps;
     AreafactRepeater.DataBind();
 }
Example #13
0
        //绑定搜索的四六级报名信息
        public void DataBindEnglishExamSignUpInfo()
        {
            DalOperationAboutEnglishExam doac = new DalOperationAboutEnglishExam();
            DataView dv = doac.GetEnglishExamSignUpInfoByTeacherNoAndLocale("admin", ddlSerachSchoolClass.SelectedValue == "all", ddlSerachSchoolClass.SelectedValue, txtKeyword.Text.Trim().Length > 0, txtKeyword.Text.Trim(), false, ddlSearchLocale.SelectedValue).Tables[0].DefaultView;

            this.AspNetPager2.RecordCount = dv.Count;

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

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

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

            if (pds.Count == 0)
            {
                this.dlstEnglishExamSignUpInfo.ShowFooter = true;
            }
            else
            {
                this.dlstEnglishExamSignUpInfo.ShowFooter = false;
            }
        }
Example #14
0
        public void fillData()
        {
            int idGDV = int.Parse(Request.Cookies["MaGDV"].Value);

            DataTable dt = daoNews.GetListByGDV(idGDV);
            PagedDataSource pgitems = new PagedDataSource();
            System.Data.DataView dv = new System.Data.DataView(dt);
            pgitems.DataSource = dv;
            pgitems.AllowPaging = true;
            pgitems.PageSize = 20;
            if (PageNumber >= pgitems.PageCount) PageNumber = 0;
            pgitems.CurrentPageIndex = PageNumber;
            if (pgitems.PageCount > 1)
            {
                rptPages.Visible = true;
                System.Collections.ArrayList pages = new System.Collections.ArrayList();
                for (int i = 0; i < pgitems.PageCount; i++)
                    pages.Add((i + 1).ToString());
                rptPages.DataSource = pages;
                rptPages.DataBind();
            }
            else
                rptPages.Visible = false;

            repeaterList.DataSource = pgitems;
            repeaterList.DataBind();
        }
Example #15
0
		private void BindData()
		{
			PagedDataSource pds = new PagedDataSource();
			pds.AllowPaging = true;
			pds.PageSize = PagerTop.PageSize;

			using ( DataTable dt =
						YAF.Classes.Data.DB.user_list( PageContext.PageBoardID, null, null,
						group.SelectedIndex <= 0 ? null : group.SelectedValue,
						rank.SelectedIndex <= 0 ? null : rank.SelectedValue
						) )
			{
				using ( DataView dv = dt.DefaultView )
				{
					if ( name.Text.Trim().Length > 0 || ( Email.Text.Trim().Length > 0 ) )
						dv.RowFilter = string.Format( "Name like '%{0}%' and Email like '%{1}%'", name.Text.Trim(), Email.Text.Trim() );

					PagerTop.Count = dv.Count;
					pds.DataSource = dv;

					pds.CurrentPageIndex = PagerTop.CurrentPageIndex;
					if ( pds.CurrentPageIndex >= pds.PageCount ) pds.CurrentPageIndex = pds.PageCount - 1;

					UserList.DataSource = pds;
					UserList.DataBind();
				}
			}
		}
Example #16
0
 protected void LoadData()
 {
     db dbc = new db();
     string query = "SELECT * FROM pages ORDER BY id DESC";
     dbc.cmd.CommandText = query;
     SqlDataAdapter da = new SqlDataAdapter(dbc.cmd);
     DataTable dt = new DataTable();
     da.Fill(dt);
     PagedDataSource pgitems = new PagedDataSource();
     DataView dv = new DataView(dt);
     pgitems.DataSource = dv;
     pgitems.AllowPaging = true;
     pgitems.PageSize = 9;
     pgitems.CurrentPageIndex = PageNumber;
     if (pgitems.PageCount > 1)
     {
         rptPages.Visible = true;
         ArrayList pages = new ArrayList();
         for (int i = 0; i < pgitems.PageCount; i++)
             pages.Add((i + 1).ToString());
         rptPages.DataSource = pages;
         rptPages.DataBind();
     }
     else
         rptPages.Visible = false;
     rptContent.DataSource = pgitems;
     rptContent.DataBind();
 }
        public int pcount = 0; //总条数

        #endregion Fields

        #region Methods

        public void RptBind()
        {
            string strWhere = "";
            if (Session["strWhereProduct"] != null && Session["strWhereProduct"].ToString() != "")
            {
                strWhere += Session["strWhereProduct"].ToString();
            }

            Cms.DAL.ProductInfo dal = new Cms.DAL.ProductInfo();
            DataSet ds = dal.GetProductList(strWhere);
            DataView dv = ds.Tables[0].DefaultView;
            //利用PAGEDDAGASOURCE类来分页
            PagedDataSource pds = new PagedDataSource();
            AspNetPager1.RecordCount = dv.Count;
            pcount = dv.Count;
            pds.DataSource = dv;
            pds.AllowPaging = true;
            pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1;
            pds.PageSize = AspNetPager1.PageSize;
            //获得总条数
            pcount = dv.Count;
            //绑定数据
            rptList.DataSource = pds;
            rptList.DataBind();
        }
        // paging for repeater
        private void FetchData(int take, int pageSize)
        {
            using (NORTHWNDEntities dc = new NORTHWNDEntities())
            {
                var query = from p in dc.Employees
                            .OrderBy(o => o.FirstName)
                            .Take(take)
                            .Skip(pageSize)
                            select new
                            {
                                ID = p.EmployeeID,
                                Name = p.FirstName + "" + p.LastName,
                                Count = dc.Employees.Count()
                            };

                PagedDataSource page = new PagedDataSource();
                page.AllowCustomPaging = true;
                page.AllowPaging = true;
                page.DataSource = query;
                page.PageSize = 10;

                rEmployees.DataSource = page;
                rEmployees.DataBind();

                if (!IsPostBack)
                {
                    RowCount = query.First().Count;
                    CreatePagingControl();
                }
            }
        }
Example #19
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();
        }
Example #20
0
        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();
                }
        }
Example #21
0
 private void Bind()
 {
     PagedDataSource ps = new PagedDataSource();
     ps.DataSource = bll.ShowAllAd();
     ps.AllowPaging = true;
     ps.PageSize = 3;
     lbPage.Text = ps.PageCount.ToString();
     ps.CurrentPageIndex = currentPage;
     FirstPage.Enabled = true;
     PriorPage.Enabled = true;
     NextPage.Enabled = true;
     LastPage.Enabled = true;
     if (lbCurrentPage.Text == "1")
     {
         FirstPage.Enabled = false;
         PriorPage.Enabled = false;
     }
     if (lbCurrentPage.Text == ps.PageCount.ToString())
     {
         NextPage.Enabled = false;
         LastPage.Enabled = false;
     }
     AdsDataList.DataSource = ps;
     AdsDataList.DataKeyField = "ID";
     AdsDataList.DataBind();
 }
        private void RptBind(string strWhere)
        {
            Cms.DAL.NewsInfo dal = new Cms.DAL.NewsInfo();
            if (String.IsNullOrEmpty(strWhere))
                strWhere = "IsLock = 0";
            else
                strWhere += " AND IsLock = 0";

            DataSet ds = dal.GetList(strWhere);
            DataView dv = ds.Tables[0].DefaultView;
            //利用PAGEDDAGASOURCE类来分页
            PagedDataSource pds = new PagedDataSource();
            AspNetPager1.RecordCount = dv.Count;
            pds.DataSource = dv;
            pds.AllowPaging = true;
            pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1;
            pds.PageSize = AspNetPager1.PageSize;
            //获得总条数
            pcount = dv.Count;
            if (this.pcount == 0)
            {
                this.lbmsg.Visible = true;
                this.lbmsg.Text = "暂时没有新闻";
            }
            //绑定数据
            rptList.DataSource = pds;
            rptList.DataBind();
        }
Example #23
0
        /// <summary>
        /// 分页
        /// </summary>
        public static PagedDataSource Fy(PagedDataSource pds, int _pagesize, int _pagenum, string herf, Literal l1, Literal l2, Literal l3, Literal l4, Literal l5, Literal l6, Literal l7, Literal l8, Literal l9, Literal l10)
        {
            pds.AllowPaging = true;
            pds.PageSize = _pagesize;
            pds.CurrentPageIndex = _pagenum;
            string leftstyle = " width:18px; height:18px; display: inline-block; vertical-align:middle; background: url('/image/fen1.jpg');";
            string left = "<a href=\"{0}\" style=\"{1}\"></a>";
            string rightstyle = " width:18px; height:18px; display: inline-block; vertical-align:middle; background: url('/image/fen2.jpg');";
            string right = "<a href=\"{0}\" style=\"{1}\"></a>";
            string mid = "<a href='{0}' class='{1}'>[{2}]</a>";
            string midclass = "dl1";

            //共多少条/页
            if (pds.PageCount != 1)
            {
                //页数
                l1.Text = "共" + pds.DataSourceCount + "条 当前" + (pds.CurrentPageIndex + 1) + "/" + pds.PageCount + "页&nbsp;&nbsp;&nbsp;&nbsp;";

                if (pds.IsLastPage)
                {
                    l2.Text = String.Format(left, String.Format(herf, (pds.PageCount - 2).ToString()), leftstyle) + "&nbsp;&nbsp;";
                    l3.Text = pds.PageCount - 4 > 0 ? String.Format(mid, String.Format(herf, (pds.PageCount - 5).ToString()), midclass, (pds.PageCount - 4).ToString()) : "";
                    l4.Text = pds.PageCount - 3 > 0 ? String.Format(mid, String.Format(herf, (pds.PageCount - 4).ToString()), midclass, (pds.PageCount - 3).ToString()) : "";
                    l5.Text = pds.PageCount - 2 > 0 ? String.Format(mid, String.Format(herf, (pds.PageCount - 3).ToString()), midclass, (pds.PageCount - 2).ToString()) : "";
                    l6.Text = pds.PageCount - 1 > 0 ? String.Format(mid, String.Format(herf, (pds.PageCount - 2).ToString()), midclass, (pds.PageCount - 1).ToString()) : "";
                    l7.Text = pds.PageCount.ToString();
                    l8.Text = "";
                    l9.Text = "";
                    l10.Text = "";
                }

                if (pds.IsFirstPage)
                {
                    l2.Text = "";
                    l3.Text = "1";
                    l4.Text = pds.CurrentPageIndex + 2 <= pds.PageCount ? String.Format(mid, String.Format(herf, (pds.CurrentPageIndex + 1).ToString()), midclass, (pds.CurrentPageIndex + 2).ToString()) : "";
                    l5.Text = pds.CurrentPageIndex + 3 <= pds.PageCount ? String.Format(mid, String.Format(herf, (pds.CurrentPageIndex + 2).ToString()), midclass, (pds.CurrentPageIndex + 3).ToString()) : "";
                    l6.Text = pds.CurrentPageIndex + 4 <= pds.PageCount ? String.Format(mid, String.Format(herf, (pds.CurrentPageIndex + 3).ToString()), midclass, (pds.CurrentPageIndex + 4).ToString()) : "";
                    l7.Text = pds.CurrentPageIndex + 5 <= pds.PageCount ? String.Format(mid, String.Format(herf, (pds.CurrentPageIndex + 4).ToString()), midclass, (pds.CurrentPageIndex + 5).ToString()) : "";
                    l8.Text = pds.CurrentPageIndex + 2 <= pds.PageCount ? "&nbsp;&nbsp;" + String.Format(right, String.Format(herf, (pds.CurrentPageIndex + 1).ToString()), rightstyle) : "";
                    l9.Text = "";
                    l10.Text = "";
                }

                if ((!pds.IsFirstPage) && (!pds.IsLastPage))
                {
                    l2.Text = String.Format(left, String.Format(herf, (pds.CurrentPageIndex - 1).ToString()), leftstyle) + "&nbsp;&nbsp;"; ;
                    l3.Text = (pds.CurrentPageIndex - 2 > 0) ? String.Format(mid, String.Format(herf, (pds.CurrentPageIndex - 3).ToString()), midclass, (pds.CurrentPageIndex - 2).ToString()) : "";
                    l4.Text = (pds.CurrentPageIndex - 1 > 0) ? String.Format(mid, String.Format(herf, (pds.CurrentPageIndex - 2).ToString()), midclass, (pds.CurrentPageIndex - 1).ToString()) : "";
                    l5.Text = pds.CurrentPageIndex > 0 ? String.Format(mid, String.Format(herf, (pds.CurrentPageIndex - 1).ToString()), midclass, (pds.CurrentPageIndex).ToString()) : "";
                    l6.Text = (pds.CurrentPageIndex + 1).ToString();
                    l7.Text = pds.CurrentPageIndex + 1 < pds.PageCount ? String.Format(mid, String.Format(herf, (pds.CurrentPageIndex + 1).ToString()), midclass, (pds.CurrentPageIndex + 2).ToString()) : "";
                    l8.Text = (pds.CurrentPageIndex + 2 < pds.PageCount) ? String.Format(mid, String.Format(herf, (pds.CurrentPageIndex + 2).ToString()), midclass, (pds.CurrentPageIndex + 3).ToString()) : "";
                    l9.Text = (pds.CurrentPageIndex + 3 < pds.PageCount) ? String.Format(mid, String.Format(herf, (pds.CurrentPageIndex + 3).ToString()), midclass, (pds.CurrentPageIndex + 4).ToString()) : "";
                    l10.Text = "&nbsp;&nbsp;" + String.Format(right, String.Format(herf, (pds.CurrentPageIndex + 1).ToString()), rightstyle);

                }
            }
            return pds;
        }
Example #24
0
 protected override void InitializePager(GridViewRow row, int columnSpan, PagedDataSource pagedDataSource)
 {
     if (UseCustomPager)
         CreateCustomPager(row, columnSpan, pagedDataSource);
     else
         base.InitializePager(row, columnSpan, pagedDataSource);
 }
Example #25
0
        /*    protected void Page_Init(object sender, EventArgs e)
        {
            this.gp.Attributes.Add("onchange", Page.ClientScript.GetPostBackEventReference(this.gp, "onchange"));
        }
        */
        public void aa()
        {
            string connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["TtNum"].ConnectionString;
            SqlConnection conn = new SqlConnection(connectionString);

            SqlDataAdapter da = new SqlDataAdapter();
            da.SelectCommand = new SqlCommand("select * from GoodSort", conn);
            DataSet ds = new DataSet();
            try
            {
                conn.Open();
                da.Fill(ds, "GoodSort");
                conn.Close();
            }
            catch (SqlException e2)
            {
                Response.Write(e2.ToString());
            }
            PagedDataSource obj = new PagedDataSource();
            obj.DataSource = ds.Tables["GoodSort"].DefaultView;
            DropDownList1.DataSource = obj;

            this.DropDownList1.DataTextField = "Sort_name";
            this.DropDownList1.DataValueField = "Sort_ID";
            this.DropDownList1.DataBind();
            DropDownList1.Items.Insert(0, new ListItem("--请选择--"));
            DropDownList2.Items.Insert(0, new ListItem("--请选择--"));
        }
Example #26
0
        private void bindDataWithPaging(Control bindControl, DataTable table)
        {
            if (table != null && table.Rows.Count > 0)
            {
                DataView dv = table.DefaultView;

                PagedDataSource dsP = new PagedDataSource();
                dsP.AllowPaging = true;
                dsP.DataSource = dv;
                dsP.CurrentPageIndex = CurrentPageIndex;
                dsP.PageSize = PageSize;

                //Binding data to the controls
                if (bindControl is DataList)
                {
                    ((DataList)bindControl).DataSource = dsP;
                    ((DataList)bindControl).DataBind();
                }
                else if (bindControl is Repeater)
                {
                    ((Repeater)bindControl).DataSource = dsP;
                    ((Repeater)bindControl).DataBind();
                }

                //saving the total page count in Viewstate for later use
                PageCount = dsP.PageCount;

                //create the linkbuttons for pagination
                BuildPagination();
            }
        }
        public void show()
        {
            SqlConnection conn = sqlHelper.Connection();
            string CommandText = @"select * from ShopThing";
            DataSet dataSet = sqlHelper.DataSetBySqlCommand(CommandText, conn);

            int curpage = Convert.ToInt32(this.Label2.Text);
            PagedDataSource ps = new PagedDataSource();
            DataSet ds = dataSet; //这里是数据源

            ps.DataSource = ds.Tables[0].DefaultView;
            ps.AllowPaging = true; //是否可以分页
            ps.PageSize = 10; //显示的数量,也就是每页要显示多少条记录
            ps.CurrentPageIndex = curpage - 1; //取得当前页的页码

            this.LinkButton1.Enabled = true;
            this.LinkButton2.Enabled = true;
            this.LinkButton3.Enabled = true;
            this.LinkButton4.Enabled = true;

            if (curpage == 1)
            {
                this.LinkButton1.Enabled = false;//不显示首页按钮
                this.LinkButton2.Enabled = false;//不显示上一页按钮
            }
            if (curpage == ps.PageCount)
            {
                this.LinkButton3.Enabled = false;//不显示下一页
                this.LinkButton4.Enabled = false;//不显示尾页
            }
            this.Label1.Text = Convert.ToString(ps.PageCount);

            DataList1.DataSource = ps;
            DataList1.DataBind();
        }
Example #28
0
        //绑定信息
        public void DataListBindEnrollList()
        {
            //检查是否有活动届次和活动类型数据

            if (!(ddlGameCategory.Items.Count > 0 && ddlGameType.Items.Count > 0))
            {
                Javascript.GoHistory(-1, "当前暂无活动届次和活动类型信息:(", Page);
                return;
            }

            DalOperationAboutGameDrawList doan = new DalOperationAboutGameDrawList();
            DataTable dt = doan.GetList(int.Parse(ddlGameCategory.SelectedValue), int.Parse(ddlGameType.SelectedValue)).Tables[0];

            this.AspNetPager3.RecordCount = dt.Rows.Count;
            AspNetPager3.PageSize = CommonUtility.pageSize;

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

            pds.CurrentPageIndex = AspNetPager3.CurrentPageIndex - 1;
            pds.PageSize = AspNetPager3.PageSize;

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

            if (pds.Count == 0)
            {
                this.dlEnroll.ShowFooter = true;
            }
            else
            {
                this.dlEnroll.ShowFooter = false;
            }
        }
Example #29
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= 'view.aspx'; </script> ");
            }

            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();
        }
 private void ControlsDataBind()
 {
     PagedDataSource pds = new PagedDataSource();
     pds.DataSource = new BLL.UserBLL().Select();
     pds.AllowPaging = true;
     pds.PageSize = 10;
     int curPage = Convert.ToInt32(lblIndex.Text);
     pds.CurrentPageIndex = curPage - 1;
     lblCount.Text = pds.PageCount.ToString();
     if (curPage == 1)
     {
         btnUp.Enabled = false;
     }
     else
     {
         btnUp.Enabled = true;
     }
     if (curPage == pds.PageCount)
     {
         btnNext.Enabled = false;
     }
     else
     {
         btnNext.Enabled = true;
     }
     repUserList.DataSource = pds;
     repUserList.DataBind();
 }
Example #31
0
        protected override System.Collections.ICollection CreateColumns(System.Web.UI.WebControls.PagedDataSource dataSource, bool useDataSource)
        {
            DataControlFieldCollection MarkupColumns = base.Columns.CloneFields();
            ArrayList GeneratedColumns = (ArrayList)base.CreateColumns(dataSource, useDataSource);
            ArrayList FinalColumns     = new ArrayList();

            for (int i = MarkupColumns.Count; i < GeneratedColumns.Count; i++)
            {
                FinalColumns.Add(GeneratedColumns[i]);
            }
            for (int i = 0; i < MarkupColumns.Count; i++)
            {
                FinalColumns.Add(MarkupColumns[i]);
            }
            return(FinalColumns);
        }
Example #32
0
        protected override void InitializePager(ASP.GridViewRow row, int columnSpan, ASP.PagedDataSource pagedDataSource)
        {
            this.virtualItemCount = pagedDataSource.DataSourceCount;
            bool hide = (this.hidePagerOnOnePage && pagedDataSource.PageCount <= 1);

            if (!hide)
            {
                if (this.UseCoolPager)
                {
                    this.CreateCoolPager(row, columnSpan, pagedDataSource);
                }
                else
                {
                    base.InitializePager(row, columnSpan, pagedDataSource);
                }
            }
        }
Example #33
0
        protected override void InitializePager(System.Web.UI.WebControls.GridViewRow row, int columnSpan, System.Web.UI.WebControls.PagedDataSource pagedDataSource)
        {
            HtmlGenericControl ul = new HtmlGenericControl("ul");

            ul.Attributes.Add("class", "pagination pull-right");

            AddPager(ul, commandArgument: "First", text: "<span class='glyphicon glyphicon-fast-backward'></span>");

            for (int i = 0; i < PageCount; i++)
            {
                AddPager(ul, i);
            }

            AddPager(ul, commandArgument: "Last", text: "<span class='glyphicon glyphicon-fast-forward'></span>");

            row.CssClass = "table-footer";
            row.Cells.Add(new System.Web.UI.WebControls.TableCell());
            row.Cells[0].ColumnSpan = columnSpan;
            row.Cells[0].Controls.AddAt(0, ul);
        }
        public override List <AutoGeneratedField> CreateAutoGeneratedFields(object dataObject, Control control)
        {
            if (!(control is GridView))
            {
                throw new ArgumentException(SR.GetString(SR.InvalidDefaultAutoFieldGenerator, GetType().FullName, typeof(GridView).FullName));
            }

            Debug.Assert(dataObject == null || dataObject is PagedDataSource);

            PagedDataSource dataSource = dataObject as PagedDataSource;
            GridView        gridView   = control as GridView;

            if (dataSource == null)
            {
                // note that we're not throwing an exception in this case, and the calling
                // code should be able to handle a null arraylist being returned
                return(null);
            }

            List <AutoGeneratedField>    generatedFields = new List <AutoGeneratedField>();
            PropertyDescriptorCollection propDescs       = null;
            bool throwException = true;

            // try ITypedList first
            // A PagedDataSource implements this, but returns null, if the underlying data source
            // does not implement it.
            propDescs = ((ITypedList)dataSource).GetItemProperties(new PropertyDescriptor[0]);

            if (propDescs == null)
            {
                Type   sampleItemType = null;
                object sampleItem     = null;

                IEnumerable realDataSource = dataSource.DataSource;
                Debug.Assert(realDataSource != null, "Must have a real data source when calling CreateAutoGeneratedColumns");

                Type dataSourceType = realDataSource.GetType();

                // try for a typed Row property, which should be present on strongly typed collections
                PropertyInfo itemProp = dataSourceType.GetProperty("Item", BindingFlags.Public | BindingFlags.Instance, null, null, new Type[] { typeof(int) }, null);
                if (itemProp != null)
                {
                    sampleItemType = itemProp.PropertyType;
                }

                if ((sampleItemType == null) || (sampleItemType == typeof(object)))
                {
                    // last resort... try to get ahold of the first item by beginning the
                    // enumeration

                    IEnumerator e = dataSource.GetEnumerator();

                    if (e.MoveNext())
                    {
                        sampleItem = e.Current;
                    }
                    else
                    {
                        // we don't want to throw an exception if we're bound to an IEnumerable
                        // data source with no records... we'll simply bail and not show any data
                        throwException = false;
                    }
                    if (sampleItem != null)
                    {
                        sampleItemType = sampleItem.GetType();
                    }

                    // We must store the enumerator regardless of whether we got back an item from it
                    // because we cannot start the enumeration again, in the case of a DataReader.
                    // Code in CreateChildControls must deal appropriately for the case where
                    // there is a stored enumerator, but a null object as the first item.
                    gridView.StoreEnumerator(e, sampleItem);
                }

                if ((sampleItem != null) && (sampleItem is ICustomTypeDescriptor))
                {
                    // Get the custom properties of the object
                    propDescs = TypeDescriptor.GetProperties(sampleItem);
                }
                else if (sampleItemType != null)
                {
                    // directly bindable types: strings, ints etc. get treated specially, since we
                    // don't care about their properties, but rather we care about them directly
                    if (ShouldGenerateField(sampleItemType, gridView))
                    {
                        AutoGeneratedFieldProperties fieldProps = new AutoGeneratedFieldProperties();
                        ((IStateManager)fieldProps).TrackViewState();

                        fieldProps.Type      = sampleItemType;
                        fieldProps.Name      = "Item";
                        fieldProps.DataField = AutoGeneratedField.ThisExpression;

                        AutoGeneratedField field = CreateAutoGeneratedFieldFromFieldProperties(fieldProps);
                        if (field != null)
                        {
                            generatedFields.Add(field);

                            AutoGeneratedFieldProperties.Add(fieldProps);
                        }
                    }
                    else
                    {
                        // complex type... we get its properties
                        propDescs = TypeDescriptor.GetProperties(sampleItemType);
                    }
                }
            }
            else
            {
                if (propDescs.Count == 0)
                {
                    // we don't want to throw an exception if we're bound to an ITypedList
                    // data source with no records... we'll simply bail and not show any data
                    throwException = false;
                }
            }

            if ((propDescs != null) && (propDescs.Count != 0))
            {
                string[] dataKeyNames   = gridView.DataKeyNames;
                int      keyNamesLength = dataKeyNames.Length;
                string[] dataKeyNamesCaseInsensitive = new string[keyNamesLength];
                for (int i = 0; i < keyNamesLength; i++)
                {
                    dataKeyNamesCaseInsensitive[i] = dataKeyNames[i].ToLowerInvariant();
                }
                foreach (PropertyDescriptor pd in propDescs)
                {
                    Type propertyType = pd.PropertyType;
                    if (ShouldGenerateField(propertyType, gridView))
                    {
                        string name  = pd.Name;
                        bool   isKey = ((IList)dataKeyNamesCaseInsensitive).Contains(name.ToLowerInvariant());
                        AutoGeneratedFieldProperties fieldProps = new AutoGeneratedFieldProperties();
                        ((IStateManager)fieldProps).TrackViewState();
                        fieldProps.Name       = name;
                        fieldProps.IsReadOnly = isKey;
                        fieldProps.Type       = propertyType;
                        fieldProps.DataField  = name;

                        AutoGeneratedField field = CreateAutoGeneratedFieldFromFieldProperties(fieldProps);
                        if (field != null)
                        {
                            generatedFields.Add(field);
                            AutoGeneratedFieldProperties.Add(fieldProps);
                        }
                    }
                }
            }

            if ((generatedFields.Count == 0) && throwException)
            {
                // this handles the case where we got back something that either had no
                // properties, or all properties were not bindable.
                throw new InvalidOperationException(SR.GetString(SR.GridView_NoAutoGenFields, gridView.ID));
            }

            return(generatedFields);
        }
 protected virtual new void InitializePager(GridViewRow row, int columnSpan, PagedDataSource pagedDataSource)
 {
     Contract.Requires(row != null);
 }
Example #36
0
        private void InitCustomPager(System.Web.UI.WebControls.GridViewRow row, int columnSpan, System.Web.UI.WebControls.PagedDataSource pagedDataSource)
        {
            var pnlPager = new Panel();
            var _with1   = pnlPager;

            _with1.ID       = "pnlPager";
            _with1.CssClass = PagerStyle.CssClass;

            var tblPager = new Table();
            var _with2   = tblPager;

            _with2.ID          = "tblPager";
            _with2.CellPadding = 3;
            _with2.CellSpacing = 0;
            _with2.Style.Add("width", "100%");
            _with2.Style.Add("height", "100%");
            _with2.BorderStyle = BorderStyle.None;
            _with2.GridLines   = GridLines.None;

            var trPager = new TableRow();

            trPager.ID = "trPager";

            var ltlPageIndex = new Literal();

            ltlPageIndex.ID   = "ltlPageIndex";
            ltlPageIndex.Text = (PageIndex + 1).ToString();

            var ltlPageCount = new Literal();

            ltlPageCount.ID   = "ltlPageCount";
            ltlPageCount.Text = PageCount.ToString();

            var tcPageXofY = new TableCell();
            var _with3     = tcPageXofY;

            _with3.ID = "tcPageXofY";
            _with3.Controls.Add(new LiteralControl("Page "));
            _with3.Controls.Add(ltlPageIndex);
            _with3.Controls.Add(new LiteralControl(" of "));
            _with3.Controls.Add(ltlPageCount);

            var ibtnFirst = new ImageButton();
            var _with4    = ibtnFirst;

            _with4.ID          = "ibtnFirst";
            _with4.CommandName = "First";
            _with4.ToolTip     = "First Page";
            _with4.Style.Add("cursor", "pointer");
            _with4.CausesValidation = false;
            _with4.Command         += PagerCommand;

            var ibtnPrevious = new ImageButton();
            var _with5       = ibtnPrevious;

            _with5.ID          = "ibtnPrevious";
            _with5.CommandName = "Previous";
            _with5.ToolTip     = "Previous Page";
            _with5.ImageAlign  = ImageAlign.AbsMiddle;
            _with5.Style.Add("cursor", "pointer");
            _with5.CausesValidation = false;
            _with5.Command         += PagerCommand;

            var ibtnNext = new ImageButton();
            var _with6   = ibtnNext;

            _with6.ID          = "ibtnNext";
            _with6.CommandName = "Next";
            _with6.ToolTip     = "Next Page";
            _with6.ImageAlign  = ImageAlign.AbsMiddle;
            _with6.Style.Add("cursor", "pointer");
            _with6.CausesValidation = false;
            _with6.Command         += PagerCommand;

            var ibtnLast = new ImageButton();
            var _with7   = ibtnLast;

            _with7.ID          = "ibtnLast";
            _with7.CommandName = "Last";
            _with7.ToolTip     = "Last Page";
            _with7.ImageAlign  = ImageAlign.AbsMiddle;
            _with7.Style.Add("cursor", "pointer");
            _with7.CausesValidation = false;
            _with7.Command         += PagerCommand;

            if (PageIndex > 0)
            {
                ibtnFirst.Enabled    = true;
                ibtnPrevious.Enabled = true;
            }
            else
            {
                ibtnFirst.Enabled    = false;
                ibtnPrevious.Enabled = false;
                ibtnFirst.Style.Add("cursor", "default");
                ibtnPrevious.Style.Add("cursor", "default");
            }

            if (PageIndex < PageCount - 1)
            {
                ibtnNext.Enabled = true;
                ibtnLast.Enabled = true;
            }
            else
            {
                ibtnNext.Enabled = false;
                ibtnLast.Enabled = false;
                ibtnNext.Style.Add("cursor", "default");
                ibtnLast.Style.Add("cursor", "default");
            }

            var tcPagerBtns = new TableCell();
            var _with8      = tcPagerBtns;

            _with8.ID = "tcPagerBtns";
            _with8.Controls.Add(ibtnFirst);
            _with8.Controls.Add(ibtnPrevious);
            _with8.Controls.Add(new LiteralControl("&nbsp;&nbsp;"));
            _with8.Controls.Add(ibtnNext);
            _with8.Controls.Add(ibtnLast);

            var ddlPages = new DropDownList();
            var _with9   = ddlPages;

            _with9.AutoPostBack = true;

            for (var i = 1; i <= PageCount; i += +1)
            {
                _with9.Items.Add(new ListItem(i.ToString(), i.ToString()));
            }
            _with9.SelectedIndex         = PageIndex;
            _with9.CausesValidation      = false;
            _with9.SelectedIndexChanged += ddlPages_SelectedIndexChanged;

            var tcPagerDDL = new TableCell();
            var _with10    = tcPagerDDL;

            _with10.ID = "tcPagerDDL";
            _with10.Controls.Add(new LiteralControl("<table cellpadding=\"0\" cellspacing=\"0\" frame=\"void\" rules=\"none\"><tr><td style=\"padding-right: 5px;border: 0px;\">Page:</td><td style=\"border: 0px;\">"));
            _with10.Controls.Add(ddlPages);
            _with10.Controls.Add(new LiteralControl("</td></tr></table>"));

            //add cells to row
            trPager.Cells.Add(tcPageXofY);
            trPager.Cells.Add(tcPagerBtns);
            trPager.Cells.Add(tcPagerDDL);

            //add row to table
            tblPager.Rows.Add(trPager);

            //add table to div
            pnlPager.Controls.Add(tblPager);

            //add div to pager row
            row.Controls.AddAt(0, new TableCell());
            row.Cells[0].ColumnSpan = columnSpan;
            row.Cells[0].Controls.Add(pnlPager);
        }
Example #37
0
        protected override void InitializePager(System.Web.UI.WebControls.GridViewRow row, int columnSpan, System.Web.UI.WebControls.PagedDataSource pagedDataSource)
        {
            base.InitializePager(row, columnSpan, pagedDataSource);
            int recordCount = pagedDataSource.DataSourceCount;

            LinkButton First = new LinkButton();
            LinkButton Prev  = new LinkButton();
            LinkButton Next  = new LinkButton();
            LinkButton Last  = new LinkButton();

            TableCell tc = new TableCell();

            row.Controls.Clear();

            tc.Controls.Add(new LiteralControl("&nbsp"));

            #region 显示总记录数 每页记录数 当前页数/总页数
            string textFormat = String.Format(_pagertextFormat,
                                              PageSize,
                                              TotalRecordCount == 0 ? recordCount : TotalRecordCount,
                                              PageIndex + 1,
                                              PageCount);
            tc.Controls.Add(new LiteralControl(textFormat));
            tc.Controls.Add(new LiteralControl("&nbsp"));
            #endregion

            #region 设置“首页 上一页 下一页 末页”按钮
            First.Text            = "首页";
            First.CommandName     = "Page";
            First.CommandArgument = "First";
            First.CssClass        = "listViewTdLinkS1";

            Prev.Text            = "上一页";
            Prev.CommandName     = "Page";
            Prev.CommandArgument = "Prev";
            Prev.CssClass        = "listViewTdLinkS1";

            Next.Text            = "下一页";
            Next.CommandName     = "Page";
            Next.CommandArgument = "Next";
            Next.CssClass        = "listViewTdLinkS1";

            Last.Text            = "末页";
            Last.CommandName     = "Page";
            Last.CommandArgument = "Last";
            Last.CssClass        = "listViewTdLinkS1";

            if (PageIndex <= 0)
            {
                First.Enabled = Prev.Enabled = false;
            }
            else
            {
                First.Enabled = Prev.Enabled = true;
            }

            if (PageIndex >= PageCount - 1)
            {
                Next.Enabled = Last.Enabled = false;
            }
            else
            {
                Next.Enabled = Last.Enabled = true;
            }

            tc.Controls.Add(First);
            tc.Controls.Add(new LiteralControl("&nbsp;"));
            tc.Controls.Add(Prev);
            tc.Controls.Add(new LiteralControl("&nbsp;"));
            tc.Controls.Add(Next);
            tc.Controls.Add(new LiteralControl("&nbsp"));
            tc.Controls.Add(Last);
            tc.Controls.Add(new LiteralControl("&nbsp;"));


            #endregion

            #region 设置转至指定页
            tc.Controls.Add(new LiteralControl("&nbsp跳转至第"));
            TextBox tbx_go = new TextBox();
            tbx_go.ID    = "_tbx_page_go";
            tbx_go.Text  = (PageIndex + 1).ToString();
            tbx_go.Width = Unit.Pixel(30);
            tc.Controls.Add(tbx_go);
            tc.Controls.Add(new LiteralControl("页"));

            RangeValidator rg = new RangeValidator();
            rg.ControlToValidate = "_tbx_page_go";
            rg.MinimumValue      = "1";
            if (PageCount != 0)
            {
                rg.MaximumValue = PageCount.ToString();
            }
            else
            {
                rg.MaximumValue = rg.MinimumValue;
            }
            rg.ErrorMessage    = "页码范围无效";
            rg.ValidationGroup = "_checkpage";
            rg.Display         = ValidatorDisplay.Dynamic;
            rg.Type            = ValidationDataType.Integer;
            tc.Controls.Add(rg);

            Button bt_go = new Button();
            bt_go.Text            = "GO";
            bt_go.Click          += new EventHandler(bt_go_Click);
            bt_go.ValidationGroup = "_checkpage";
            tc.Controls.Add(bt_go);
            #endregion

            if (this.AutoGenerateColumns)
            {
                if (this.DataSource != null && this.DataSource.GetType().FullName == "System.Data.DataTable")
                {
                    tc.ColumnSpan = ((DataTable)this.DataSource).Columns.Count + this.Columns.Count;
                }
                else
                {
                    tc.ColumnSpan = 5;
                }
            }
            else
            {
                tc.ColumnSpan = this.Columns.Count;
            }

            row.Controls.Add(tc);
        }
 protected virtual new System.Collections.ArrayList CreateColumnSet(PagedDataSource dataSource, bool useDataSource)
 {
     return(default(System.Collections.ArrayList));
 }
 protected virtual new void InitializePager(GridViewRow row, int columnSpan, PagedDataSource pagedDataSource)
 {
 }
 protected virtual new System.Collections.ICollection CreateColumns(PagedDataSource dataSource, bool useDataSource)
 {
     return(default(System.Collections.ICollection));
 }
Example #41
0
 protected override void InitializeBottomPager(System.Web.UI.WebControls.GridViewRow row, int columnSpan, System.Web.UI.WebControls.PagedDataSource pagedDataSource)
 {
     if (this.PageIndex != this.VirtualPageIndex)
     {
         this.PageIndex = this.VirtualPageIndex;
     }
     base.InitializeBottomPager(row, columnSpan, pagedDataSource);
 }
Example #42
0
        private void CreateCoolPager(ASP.TableRow row, int columnSpan, ASP.PagedDataSource pagedDataSource)
        {
            int pageIndex = pagedDataSource.CurrentPageIndex;
            int pageCount = pagedDataSource.PageCount;
            int pageSize  = pagedDataSource.PageSize;
            int total     = pagedDataSource.DataSourceCount;

            ASP.TableCell td = new ASP.TableCell();
            DropDownList  ddlPageSelector = new DropDownList();
            Button        btnFirst        = new Button();
            Button        btnLast         = new Button();
            Button        btnNext         = new Button();
            Button        btnPrev         = new Button();
            Label         lblTotal        = new Label();

            td.ColumnSpan = columnSpan;
            row.Cells.Add(td);
            td.Controls.Add(new LiteralControl("&nbsp;Page : "));
            td.Controls.Add(ddlPageSelector);
            td.Controls.Add(btnFirst);
            td.Controls.Add(btnPrev);
            td.Controls.Add(btnNext);
            td.Controls.Add(btnLast);
            td.Controls.Add(lblTotal);

            btnNext.Text            = ">";
            btnNext.CommandArgument = "Next";
            btnNext.CommandName     = "Page";

            btnLast.Text            = ">>";
            btnLast.CommandArgument = "Last";
            btnLast.CommandName     = "Page";

            btnFirst.Text            = "<<";
            btnFirst.CommandArgument = "First";
            btnFirst.CommandName     = "Page";

            btnPrev.Text            = "<";
            btnPrev.CommandArgument = "Prev";
            btnPrev.CommandName     = "Page";

            lblTotal.Text    = this.TotalRecordString + "&nbsp;" + total.ToString();
            btnFirst.Enabled = btnPrev.Enabled = (pageIndex != 0);
            btnNext.Enabled  = btnLast.Enabled = (pageIndex < (pageCount - 1));
            ddlPageSelector.Items.Clear();

            if (this.AddCallBacks)
            {
                ddlPageSelector.AutoCallBack = true;
            }
            else
            {
                ddlPageSelector.AutoPostBack = true;
            }
            for (int i = 1; i <= pageCount; i++)
            {
                ddlPageSelector.Items.Add(i.ToString());
            }
            ddlPageSelector.SelectedIndex         = pageIndex;
            ddlPageSelector.SelectedIndexChanged += delegate {
                this.PageIndex = ddlPageSelector.SelectedIndex;
                this.DataBind();
            };
        }
Example #43
0
 protected virtual new void InitializePager(DetailsViewRow row, PagedDataSource pagedDataSource)
 {
     Contract.Requires(this.PagerSettings != null);
     Contract.Requires(row != null);
     Contract.Requires(row.Cells != null);
 }
 protected virtual new void InitializePager(DataGridItem item, int columnSpan, PagedDataSource pagedDataSource)
 {
 }
 protected virtual new void InitializePager(FormViewRow row, PagedDataSource pagedDataSource)
 {
 }