本文整理匯總了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();
}
}
}
示例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;
}
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
}
示例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();
}
示例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();
}
示例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();
}
}
}
示例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();
}
示例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;
}
}
示例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();
}
示例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("--請選擇--"));
}