- 爱易网页
-
ASP.NET教程
- anpnetpager Url 分页异常
日期:2014-05-18 浏览次数:20538 次
anpnetpager Url 分页错误
UrlPaging 设置为 true
为什么每次anpPager.CurrentPageIndex 都是1
private void Page_Load(object sender, System.EventArgs e)
{
BindOrgList(anpPager.CurrentPageIndex,OrderType,IsOnSearch);
}
private void anpPager_PageChanged(object sender, EventArgs e)
{
}
#region 绑定机构列表
/// <summary>
/// 绑定机构列表
/// </summary>
/// <param name= "pageSize "> 页大小 </param>
/// <param name= "currrentPage "> 当前页 </param>
/// <param name= "orderType "> 排序类型 </param>
/// <param name= "isOnSearch "> 搜索状态 </param>
protected void BindOrgList(int currentPage,int orderType,bool isOnSearch)
{
IList list;
int recordCount = 0;
string keyword= " ";
int searchScope=0;
if(isOnSearch) //如果在搜索状态则调用相应的搜索函数
{
if(Request[ "k "]!=null)
keyword = Request[ "k "].ToString();
if (Request[ "s "]!=null)
if (Request[ "action "]!=null)
{
lblshowDetail.HRef = "organizations02.aspx?action=search&s= " + Request[ "s "].ToString() + "&k= " + Request[ "k "].ToString();
}
searchScope = int.Parse(Request[ "s "].ToString());
if(searchScope==0)
list = new OrgOrgServices().SearchOrgByNameOrderByViews(anpPager.PageSize,currentPage,out recordCount,keyword);
else if(searchScope==1)
list = new OrgOrgServices().SearchOrgByManageAreaOrderByDate(anpPager.PageSize,currentPage,out recordCount,keyword);
else
list = new OrgOrgServices().SearchOrgByAreaOrderByViews(anpPager.PageSize,currentPage,out recordCount,keyword);
}
else //否则绑定所有课程信息列表
{
if (orderType==0)
{
list = new OrgOrgServices().GetAllOrgOrderByViews(anpPager.PageSize,currentPage,out recordCount);
}
else
{
list = new OrgOrgServices().GetAllOrgOrderByCreateDate(anpPager.PageSize,currentPage,out recordCount);
}
}
rptOrgInfo.DataSource = list;
rptOrgInfo.DataBind();
anpPager.RecordCount = recordCount;
}
#endregion