using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
AccessHelper helper = new AccessHelper();
string cond = "caid=6";
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
helper.CreateCommand("select count(*) from news where "+cond);
anp.RecordCount = int.Parse(helper.ExecuteScalar());
bindrep();
}
}
///
/// 页面翻页触发事件
///
///
///
protected void anp_PageChanged(object sender, EventArgs e)
{
bindrep();
}
///
/// 绑定分页
///
private void bindrep()
{
int pagesize = anp.PageSize;
int pageindex = anp.CurrentPageIndex;
gv.DataSource = helper.FengYe("(news n inner join newsca ca on n.caid=ca.id)", "*", "createdate", "desc", cond, pagesize, pageindex);
gv.DataBind();
}
}