使用aspnetpager能分页但显示不出数据
使用webdiyer的aspnetpager,通过BLL层调用,BLL层的操作类如下:
public SqlDataReader ManagerList(int startIndex, int pageSize)
{
DataOperaSql objConfig = new DataOperaSql();
SqlDataReader dataReader = null;
SqlParameter[] Param = {
objConfig.MakeInParam( "@pagesize ",SqlDbType.Int,4,pageSize),
objConfig.MakeInParam( "@pageindex ",SqlDbType.Int,4,startIndex)
};
objConfig.RunProc( "Manager_List ", Param, out dataReader);
return dataReader;
}
此函数运行正常,并能读取到第一页的数据,但第二页后的数据就不能读出来了,奇怪的是aspnetpager1的分页是根据所读出的pagesize进行分页,可以正常显示,但datalist中第二页以后的数据不能读取,一片空白.
前台页面的CS代码如下:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ManagerOpera objManagerOpera = new ManagerOpera();
AspNetPager1.RecordCount = objManagerOpera.GetManagerCount();
lblAdminCount.Text = AspNetPager1.RecordCount + "位 ";
this.ShowAdminList();
}
}
protected void Button1_Click(object sender, EventArgs e)
{
this.pnlAdminAdd.Visible = true;
this.Button1.Enabled = false;
}
protected void ShowAdminList()
&nbs