本文整理汇总了C#中PagedDataSource类的典型用法代码示例。如果您正苦于以下问题:C# PagedDataSource类的具体用法?C# PagedDataSource怎么用?C# PagedDataSource使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PagedDataSource类属于命名空间,在下文中一共展示了PagedDataSource类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: bindNew
protected void bindNew()
{
//获取当前页码
int noncePage = Convert.ToInt32(labPage.Text);
//创建PagedDataSource对象用来实现分页
PagedDataSource ps = new PagedDataSource();
string sqlSel = "select * from videoInfo where Auditing='1' order by videoDate desc";
//调用公共类中的getRows方法并将所返回的所有数据绑定到PagedDataSource数据源中
ps.DataSource = operateData.getRows(sqlSel).DefaultView;
//设置启动分页
ps.AllowPaging = true;
//设置每页显示的项数
ps.PageSize = 8;
//设置当前页的索引
ps.CurrentPageIndex = noncePage - 1;
this.lnkbtnFront.Enabled = true;
this.lnkbtnNext.Enabled = true;
this.lnkbtnLast.Enabled = true;
this.lnkbtnFirst.Enabled = true;
//如果当前为第一页将不显示第一页按钮和上一页按钮
if (noncePage == 1)
{
this.lnkbtnFirst.Enabled = false;//不显示第一页按钮
this.lnkbtnFront.Enabled = false;//不显示上一页按钮
}
//如果当前为最后一页将不显示最后一页按钮和下一页按钮
if (noncePage == ps.PageCount)
{
this.lnkbtnNext.Enabled = false;//不显示下一页
this.lnkbtnLast.Enabled = false;//不显示最后一页
}
labBackPage.Text = Convert.ToString(ps.PageCount);
dlNewVideo.DataSource = ps;
dlNewVideo.DataBind();
}
示例2: dlBind
/// <summary>
/// DataList控件绑定及分页
/// </summary>
/// <param name="intCount">每页显示的记录条数</param>
/// <param name="ds">DataSet数据集</param>
/// <param name="labPage">当前页码</param>
/// <param name="labTPage">总页码</param>
/// <param name="lbtnUp">上一页</param>
/// <param name="lbtnNext">下一页</param>
/// <param name="lbtnBack">最后一页</param>
/// <param name="lbtnOne">第一页</param>
/// <param name="dl">DataList控件对象</param>
public static void dlBind(int intCount, DataSet ds, Label labPage, Label labTPage, LinkButton lbtnUp, LinkButton lbtnNext, LinkButton lbtnBack, LinkButton lbtnOne, Repeater dl)
{
int curpage = Convert.ToInt32(labPage.Text);
PagedDataSource ps = new PagedDataSource();
ps.DataSource = ds.Tables[0].DefaultView;
ps.AllowPaging = true; //是否可以分页
ps.PageSize = intCount; //显示的数量
ps.CurrentPageIndex = curpage - 1; //取得当前页的页码
lbtnNext.Visible = true;
lbtnOne.Visible = true;
lbtnBack.Visible = true;
lbtnUp.Visible = true;
lbtnNext.Enabled = true;
lbtnBack.Enabled = true;
lbtnOne.Enabled = true;
if (curpage == 1)
{
lbtnOne.Visible = false;//不显示第一页按钮
lbtnUp.Visible = false;//不显示上一页按钮
}
if (curpage == ps.PageCount)
{
lbtnNext.Visible = false;//不显示下一页
lbtnBack.Visible = false;//不显示最后一页
}
labTPage.Text = Convert.ToString(ps.PageCount);
dl.DataSource = ps;
// dl.DataKeyField = "ID";
dl.DataBind();
}
示例3: dlImageBind
public void dlImageBind()
{
string strSql = "select * from tb_Image";
DataTable dsTable = dbObj.GetDataSetStr(strSql, "tbImage");
int curpage = Convert.ToInt32(this.labPage.Text);
PagedDataSource ps = new PagedDataSource();
ps.DataSource = dsTable.DefaultView;
ps.AllowPaging = true; //是否可以分页
ps.PageSize = 16; //显示的数量
ps.CurrentPageIndex = curpage - 1; //取得当前页的页码
this.lnkbtnUp.Enabled = true;
this.lnkbtnNext.Enabled = true;
this.lnkbtnBack.Enabled = true;
this.lnkbtnOne.Enabled = true;
if (curpage == 1)
{
this.lnkbtnOne.Enabled = false;//不显示第一页按钮
this.lnkbtnUp.Enabled = false;//不显示上一页按钮
}
if (curpage == ps.PageCount)
{
this.lnkbtnNext.Enabled = false;//不显示下一页
this.lnkbtnBack.Enabled = false;//不显示最后一页
}
this.labBackPage.Text = Convert.ToString(ps.PageCount);
this.dlImage.DataSource = ps;
this.dlImage.DataKeyField = dsTable.Columns[0].ToString();
this.dlImage.DataBind();
}
示例4: dlBind
public void dlBind()
{
int curpage = Convert.ToInt32(labNowPage.Text);
PagedDataSource ps = new PagedDataSource();
string sqlStr = "SELECT * FROM tb_Reply WHERE ReplyID='" + Request["ID"].ToString() + "'";
SqlCommand myCmd=dbObj.GetCommandStr(sqlStr);
DataTable dsTable = dbObj.GetDataSet(myCmd, "tbReplay");
ps.DataSource = dsTable.DefaultView;
ps.AllowPaging = true; //是否可以分页
ps.PageSize = 10; //显示的数量
ps.CurrentPageIndex = curpage - 1; //取得当前页的页码
lnkbtnPrve.Enabled = true;
lnkbtnTop.Enabled = true;
lnkbtnNext.Enabled = true;
lnkbtnLast.Enabled = true;
if (curpage == 1)
{
lnkbtnTop.Enabled = false;//不显示第一页按钮
lnkbtnPrve.Enabled = false;//不显示上一页按钮
}
if (curpage == ps.PageCount)
{
lnkbtnNext.Enabled = false;//不显示下一页
lnkbtnLast.Enabled = false;//不显示最后一页
}
this.labCount.Text = Convert.ToString(ps.PageCount);
this.DataList1.DataSource = ps;
this.DataList1.DataKeyField = "ID";
this.DataList1.DataBind();
}
示例5: 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();
}
}
示例6: DataListBindCourseNotify
protected void DataListBindCourseNotify()
{
DalOperationAboutCourses doac = new DalOperationAboutCourses();
DataView dv = doac.GetCoursesInfo(Master.courseNo,Master.classID,Master.termtag, "3").Tables[0].DefaultView;//第3个标签,绑定课程通知信息
this.AspNetPager2.RecordCount = dv.Count;
PagedDataSource pds = new PagedDataSource(); //定义一个PagedDataSource类来执行分页功
pds.DataSource = dv;
pds.AllowPaging = true;
pds.CurrentPageIndex = pageIndex - 1;
pds.PageSize = CommonUtility.pageSize; ;
this.dlstCourseNotify.DataSource = pds;
this.dlstCourseNotify.DataBind();
if (this.dlstCourseNotify.Items.Count == 0)
{
btnDelete.Visible = false;
}
else
{
btnDelete.Visible = true;
}
if (pds.Count > 0)
{
this.dlstCourseNotify.ShowFooter = false;
}
}
示例7: FilterSearch
public void FilterSearch()
{
if (Session["kindid"] != null && Session["name"] != null)
{
PagedDataSource objPage = new PagedDataSource();
try
{
DataSet ds = new DataSet();
ds = getDS.getData("Product");
DataTable dt = new DataTable();
dt = ds.Tables[0];
DataView dv = new DataView(dt);
dv.RowFilter = "KindID = '" + Session["kindid"].ToString() + "' and ProName = '" + Session["name"].ToString() + "'";
DataList1.RepeatColumns = 3;
DataList1.DataSource = dv;
DataList1.DataBind();
}
catch (Exception ex)
{
}
finally
{
objPage = null;
}
}
else
{
}
}
示例8: dlBind
public void dlBind()
{
int curpage = Convert.ToInt32(labNowPage.Text); //当前页
PagedDataSource ps = new PagedDataSource(); //定义一个PagedDataSource类对象
//获取留言信息
string strSql = "SELECT * FROM tb_LeaveWord WHERE Uid='" + Session["UserName"].ToString() + "'";
SqlCommand myCmd = dbObj.GetCommandStr(strSql);
DataTable dsTable = dbObj.GetDataSet(myCmd, "tbLeaveWord");
ps.DataSource =dsTable.DefaultView;
ps.AllowPaging = true; //是否可以分页
ps.PageSize = 10; //显示的数量
ps.CurrentPageIndex = curpage - 1; //取得当前页的页码
lnkbtnPrve.Enabled = true;
lnkbtnTop.Enabled = true;
lnkbtnNext.Enabled = true;
lnkbtnLast.Enabled = true;
if (curpage == 1)
{
lnkbtnTop.Enabled = false;//不显示第一页按钮
lnkbtnPrve.Enabled = false;//不显示上一页按钮
}
if (curpage == ps.PageCount)
{
lnkbtnNext.Enabled = false;//不显示下一页
lnkbtnLast.Enabled = false;//不显示最后一页
}
this.labCount.Text = Convert.ToString(ps.PageCount);//页的总数
//绑定DataList控件,显示留言信息
this.dlMyWord.DataSource = ps;
this.dlMyWord.DataKeyField = "ID";
this.dlMyWord.DataBind();
}
示例9: dlBind
public void dlBind()
{
int curpage = Convert.ToInt32(labNowPage.Text);
PagedDataSource ps = new PagedDataSource();
string strSql = "SELECT * FROM tb_LeaveWord order by DateTime Desc";
SqlCommand myCmd = dbObj.GetCommandStr(strSql);
DataTable dsTable = dbObj.GetDataSet(myCmd, "tbLeaveWord");
ps.DataSource = dsTable.DefaultView;
ps.AllowPaging = true; //是否可以分页
ps.PageSize = 10; //显示的数量
ps.CurrentPageIndex = curpage - 1; //取得当前页的页码
lnkbtnPrve.Enabled = true;
lnkbtnTop.Enabled = true;
lnkbtnNext.Enabled = true;
lnkbtnLast.Enabled = true;
if (curpage == 1)
{
lnkbtnTop.Enabled = false;//不显示第一页按钮
lnkbtnPrve.Enabled = false;//不显示上一页按钮
}
if (curpage == ps.PageCount)
{
lnkbtnNext.Enabled = false;//不显示下一页
lnkbtnLast.Enabled = false;//不显示最后一页
}
this.labCount.Text = Convert.ToString(ps.PageCount);
this.dlManage.DataSource = ps;
this.dlManage.DataKeyField = "ID";
this.dlManage.DataBind();
}
示例10: BindList
protected void BindList()
{
// edit by shiney
string type = ViewState["type"].ToString();
DataTable dt = AccessHelper.ExecuteDataTable(strConnection, CommandType.Text,
"select C.ID,C.Title,C.CreateTime,C.ViewTimes,T.TypeCode from Contents C,ContentAndType CT,ContentType T where C.ID=CT.ContentID And T.ID=CT.TypeID And T.TypeCode='" + type + "'");
// "SELECT ID, Title, CreateTime,ViewTimes FROM Contents WHERE TypeCode = '" + type + "'");
if (dt == null) return;
if (dt.Rows.Count == 0)
{
dvEmpty.InnerHtml += "此栏目暂无信息";
dvbtn.Visible = false;
}
if (dt.Rows.Count > 0) dvbtn.Visible = true;
PagedDataSource ps = new PagedDataSource();
ps.AllowPaging = true;
ps.PageSize = 16;
rpList.DataSource = ps;
ps.CurrentPageIndex = Convert.ToInt32(this.lbCurPage.Text) - 1;
ps.DataSource = dt.DefaultView;
this.btnPreviousPage.Enabled = true;
this.btnNextPage.Enabled = true;
if (ps.CurrentPageIndex == 0)
{
this.btnPreviousPage.Enabled = false;
}
if (ps.CurrentPageIndex == ps.PageCount - 1)
{
this.btnNextPage.Enabled = false;
}
rpList.DataBind();
}
示例11: DataListBind
//绑定用户信息到DataList
public void DataListBind()
{
DalOperationFeedBack dou = new DalOperationFeedBack();
DataView dv = dou.FindFeedBack().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.dlFeedBack.DataSource = pds;
this.dlFeedBack.DataBind();
if (this.dlFeedBack.Items.Count == 0)
{
btnDelete.Visible = false;
}
else
{
btnDelete.Visible = true;
}
if (pds.Count > 0)
{
this.dlFeedBack.ShowFooter = false;
}
}
示例12: BindList
protected void BindList()
{
// edit by shiney
DataTable dt = AccessHelper.ExecuteDataTable(strConnection, CommandType.Text,
"SELECT * FROM FileList where IsDisplay = true");
//if (dt == null) return;
if (dt.Rows.Count == 0)
{
dvEmpty.InnerHtml += "此栏目暂无信息";
dvbtn.Visible = false;
}
if (dt.Rows.Count > 0) dvbtn.Visible = true;
PagedDataSource ps = new PagedDataSource();
ps.AllowPaging = true;
ps.PageSize = 10;
rpList.DataSource = ps;
ps.CurrentPageIndex = Convert.ToInt32(this.lbCurPage.Text) - 1;
ps.DataSource = dt.DefaultView;
this.btnPreviousPage.Enabled = true;
this.btnNextPage.Enabled = true;
if (ps.CurrentPageIndex == 0)
{
this.btnPreviousPage.Enabled = false;
}
if (ps.CurrentPageIndex == ps.PageCount - 1)
{
this.btnNextPage.Enabled = false;
}
rpList.DataBind();
}
示例13: LoadPagedData
protected override void LoadPagedData()
{
List<Branch> branchesList = branchesOperator.SelectBySupplierID(Convert.ToInt32(Request.QueryString["SuppID"]), (bool?)IsArabic);
if (branchesList != null && branchesList.Count > 0)
{
PagedDataSource pager = new PagedDataSource();
pager.DataSource = branchesList;
pager.AllowPaging = true;
pager.PageSize = 10;
pager.CurrentPageIndex = CurrentPage;
if (pager.PageCount > 1)
{
btnMoveNext.Visible = true;
btnMovePrevious.Visible = true;
btnMoveNext.Enabled = !pager.IsLastPage;
btnMovePrevious.Enabled = !pager.IsFirstPage;
}
rptBranches.DataSource = pager;
rptBranches.DataBind();
lblEmptyDataMessage.Visible = false;
}
else
{
btnMoveNext.Visible = false;
btnMovePrevious.Visible = false;
lblEmptyDataMessage.Visible = true;
}
}
示例14: renderview
protected void renderview(object sender, EventArgs e)
{
GridViewRow gvr = (sender as GridView).BottomPagerRow;
if (gvr != null)
{
gvr.Visible = true;
}
PagedDataSource ps = new PagedDataSource();
ps.DataSource = ods.Select();
if (ps.DataSourceCount > 0)
{
try
{
(gvr.FindControl("ddlPageSize") as DropDownList).SelectedValue = gridList.PageSize.ToString();
}
catch (ArgumentOutOfRangeException ae)
{
(gvr.FindControl("ddlPageSize") as DropDownList).SelectedIndex = 0;
}
(gvr.FindControl("lblTotalRecord") as Label).Text = ps.DataSourceCount.ToString();
this.hidcurpage.Value = (gridList.PageIndex + 1).ToString();
}
}
示例15: GetItems
public void GetItems()
{
if (Convert.ToInt32(Session["CurrentPage"].ToString()) != 0)
{
CurrentPage = Convert.ToInt32(Session["CurrentPage"].ToString());
}
DataTable dtDB = new DataTable("ItemInfo");
DataTable dtDB1 = new DataTable("ItemInfo1");
if ( Request.QueryString["categoryid"] == null || Request.QueryString["categoryid"]=="")
{
SqlDataAdapter adpDB = new SqlDataAdapter("Select productid,producttitle,sort,model,thumbNail from Product where categoryid in (select categoryid from Category where companyid=16) order by sort ", conn);
adpDB.Fill(dtDB);
}
else
{
SqlDataAdapter adpDB = new SqlDataAdapter("Select productid,producttitle,sort,model,thumbNail from Product where categoryid in (select categoryid from Category where companyid=16 and categoryid=" + Request.QueryString["categoryid"] + ") order by sort ", conn);
adpDB.Fill(dtDB);
}
PagedDataSource objPage = new PagedDataSource();
objPage.DataSource = dtDB.DefaultView;
objPage.AllowPaging = true;
objPage.PageSize = 100;
Session["TotalPages"] = objPage.PageCount - 1;
objPage.CurrentPageIndex = CurrentPage;
DataList1.DataSource = objPage;
DataList1.DataBind();
conn.Close();
}