asp.net Repeater之非常好的数据分页(6)


using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace FrameWork.Web
{
public partial class Index : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Bind();
}
}

protected void Bind()
{
string Sql = "select count(Sys_NewsList_ID) from Sys_NewsList";//查询Sql语句

#region 列表选项

#region 分页控件基本属性

RepeaterPages1.SqlString = Sql;//用于统计总记录数和进行数据分页的Sql语句

RepeaterPages1.LastPage = "< Prev";

RepeaterPages1.NextPage = "Next > ";

RepeaterPages1.PageBeforeHtml = "";

RepeaterPages1.PageLastHtml = "";

#region 构造Url参数

System.Text.StringBuilder StrBulider = new System.Text.StringBuilder();

StrBulider.Append("&a=");

#endregion

RepeaterPages1.Url = StrBulider.ToString();

#endregion

#region 数据绑定

RepeaterPages1.DataSource = RepeaterPages1.getObjectRecordCount(true, "PageView", "Sys_NewsList", "Sys_NewsList_ID", " Sys_NewsList_ID desc", " Sys_NewsList_ID is not null");

RepeaterPages1.DataBind();

#endregion

#endregion
}
}
}



您可能感兴趣的文章:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wjfyfs.html