當前位置: 首頁>>代碼示例>>C#>>正文


C# WebControls.PagedDataSource類代碼示例

本文整理匯總了C#中System.Web.UI.WebControls.PagedDataSource的典型用法代碼示例。如果您正苦於以下問題:C# PagedDataSource類的具體用法?C# PagedDataSource怎麽用?C# PagedDataSource使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


PagedDataSource類屬於System.Web.UI.WebControls命名空間,在下文中一共展示了PagedDataSource類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: BindData

		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();
				}
			}
		}
開發者ID:coredweller,項目名稱:PhishMarket,代碼行數:28,代碼來源:users.ascx.cs

示例2: DataListBindEnrollList

        //綁定信息
        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;
            }
        }
開發者ID:skyaspnet,項目名稱:usta,代碼行數:36,代碼來源:DrawManage.aspx.cs

示例3: LoadData

 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();
 }
開發者ID:nick2il,項目名稱:GavanGallery,代碼行數:28,代碼來源:default.aspx.cs

示例4: DropDownList1_SelectedIndexChanged

        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();
        }
開發者ID:JJDJJ,項目名稱:TtNum,代碼行數:25,代碼來源:see.aspx.cs

示例5: Bind

 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();
 }
開發者ID:wakaoyun,項目名稱:dengqibin,代碼行數:26,代碼來源:AdsInfo.aspx.cs

示例6: LoadData

 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();
 }
開發者ID:baotiit,項目名稱:savvyplatform,代碼行數:25,代碼來源:QuanLyQuiTrinh.aspx.cs

示例7: show

        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();
        }
開發者ID:ningboliuwei,項目名稱:Course_ASPNET,代碼行數:35,代碼來源:BookLogin.aspx.cs

示例8: grdbind

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

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

                    }

                    PagedDataSource pds = new PagedDataSource();
                    pds.DataSource = lfeed.ToList();  //這裏好像一定要Tolist();不然會有點錯誤;
                    pds.AllowPaging = true;
                    AspNetPager1.RecordCount = lfeed.Count(); //記錄總數;
                    pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1;
                    pds.PageSize = AspNetPager1.PageSize;
                    this.rptList.DataSource = pds;
                    this.rptList.DataBind();
                }
        }
開發者ID:priceLiu,項目名稱:CMS,代碼行數:27,代碼來源:RList.aspx.cs

示例9: RptBind

        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();
        }
開發者ID:BGCX261,項目名稱:zhongzhiweb-svn-to-git,代碼行數:28,代碼來源:News.aspx.cs

示例10: LoadData

 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();
 }
開發者ID:nick2il,項目名稱:GavanGallery,代碼行數:35,代碼來源:default.aspx.cs

示例11: FetchData

        // 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();
                }
            }
        }
開發者ID:niki-funky,項目名稱:Telerik_Academy,代碼行數:32,代碼來源:Employees.aspx.cs

示例12: RptBind

        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();
        }
開發者ID:BGCX261,項目名稱:zhongzhiweb-svn-to-git,代碼行數:32,代碼來源:List.aspx.cs

示例13: DataBindEnglishExamSignUpInfo

        //綁定搜索的四六級報名信息
        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;
            }
        }
開發者ID:skyaspnet,項目名稱:usta,代碼行數:27,代碼來源:EnglishExamManage.aspx.cs

示例14: Bind

 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();
 }
開發者ID:wakaoyun,項目名稱:dengqibin,代碼行數:25,代碼來源:AreaAfact.aspx.cs

示例15: aa

        /*    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("--請選擇--"));
        }
開發者ID:JJDJJ,項目名稱:TtNum,代碼行數:33,代碼來源:add.aspx.cs


注:本文中的System.Web.UI.WebControls.PagedDataSource類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。