DataList和AspNetPager一起用的时候,第二页无数据显示,但第一页显示没问题,不是存储过程问题
public int id;
static string condition = " and";
static int pagesize = 4; //每页显示的行数
static int pageindex = 0; //页数
static int total = 0; //总共多少行
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
//传入TypeID 在左边查询同类商品
id = Convert.ToInt32(Request.QueryString["id"]);
gridviewband();
}
public void gridviewband()
{
this.DataList1.DataSource = SqlCom.getdatabyPageIndex("ProDetail", "*", condition + " ProNameID=" + id, pagesize, pageindex, "ID", out total, "SaleNum", "desc");
this.AspNetPager1.PageSize = pagesize;
this.AspNetPager1.RecordCount = total;
this.DataList1.DataBind();
}
protected void AspNetPager1_PageChanged(object sender, EventArgs e)
{
pageindex = AspNetPager1.CurrentPageIndex - 1;
gridviewband();
}
DataList,AspNetPager
------解决方案--------------------跟踪一下,是不是pageindex每次传的都是第一页?
------解决方案--------------------http://www.cnblogs.com/charles2008/archive/2008/02/01/1061396.html
------解决方案--------------------获取total值的sql的语句是什么?