本文整理汇总了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("--请选择--"));
}