首先注册一个 AspNetpager 在HTML中
<cc1:AspNetPager ID="pager" runat="server" OnPageChanged="pager_PageChanged" NumericButtonTextFormatString="[{0}] "
ShowCustomInfoSection="left" PagingButtonSpacing="8px" border="0" HorizontalAlign="right">
</cc1:AspNetPager>
查数据时 :
public IList<> GetCollection(int UserID, int pageSize, int pageIndex, string orderField, bool isASC, out int rdCount)
{
string sqlCommand = string.Format("SELECT * FROM ss where SecurityLevel < 3000 " );
DataPage page = DataReaderHelper.GetPage(sqlCommand, orderField , isASC , pageSize, pageIndex);
rdCount = page.RecordCount;
List<object> list = page.ConvertTo("Group");
IList<> retList = new List<Group>();
foreach (object obj in list)
{
retList.Add((Group)obj);
}
return retList;
}
在后台中 查出数据来后 加
this.pager.RecordCount = rdCount;
this.pager.PageSize =PageSize;
this.pager.CurrentPageIndex = strPageIndex;
<cc1:AspNetPager ID="pager" runat="server" OnPageChanged="pager_PageChanged" NumericButtonTextFormatString="[{0}] "
ShowCustomInfoSection="left" PagingButtonSpacing="8px" border="0" HorizontalAlign="right">
</cc1:AspNetPager>
查数据时 :
public IList<> GetCollection(int UserID, int pageSize, int pageIndex, string orderField, bool isASC, out int rdCount)
{
string sqlCommand = string.Format("SELECT * FROM ss where SecurityLevel < 3000 " );
DataPage page = DataReaderHelper.GetPage(sqlCommand, orderField , isASC , pageSize, pageIndex);
rdCount = page.RecordCount;
List<object> list = page.ConvertTo("Group");
IList<> retList = new List<Group>();
foreach (object obj in list)
{
retList.Add((Group)obj);
}
return retList;
}
在后台中 查出数据来后 加
this.pager.RecordCount = rdCount;
this.pager.PageSize =PageSize;
this.pager.CurrentPageIndex = strPageIndex;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货