<div class="oa-el-grid-page"> <webdiyer:AspNetPager ID="AspNetPager2" runat="server" CurrentPageButtonClass="current" OnPageChanging="AspNetPager2_PageChanging" FirstPageText="首页" LastPageText="最后一页" NextPageText="下一页" PrevPageText="上一页" HorizontalAlign="Center" ShowBoxThreshold="10" ShowPageIndexBox="Auto" AlwaysShow="True" PageSize="9"> </webdiyer:AspNetPager> ` </div>
.oa-el-grid-page a, .oa-el-grid-page input[type="submit"] { background-color: #FFFFFF; border-color: #EEEEEE; border-style: solid; border-width: 1px; color: #036CB4; margin: 2px; padding: 2px 5px; text-decoration: none; } .oa-el-grid-page .current { background-color: #036CB4; border-color: #036CB4; border-right: 1px solid #036CB4; border-style: solid; border-width: 1px; color: #FFFFFF; font-weight: bold; margin: 2px; padding: 2px 5px; }
public void DataLoad(int pidx) { string TiaoJian = " 1=1 "; if (txtxfd.Value != "") TiaoJian += " and name like ‘%" + txtxfd.Value + "%‘"; AspNetPager2.RecordCount = new BLL.Sys_card_class().GetCount(TiaoJian); //分页大小、页码、排序列,升序{False}/降序(True),条件 List<Model.Sys_card_class> LRDate = new BLL.Sys_card_class().GetPageList(AspNetPager2.PageSize, pidx, "id", false, TiaoJian); if (LRDate.Count > 0) { int i = 1; foreach (Model.Sys_card_class LR in LRDate) { ContentStr += "<tr>"; ContentStr += "<td width=\"200px\">" + i.ToString() + "</td>"; ContentStr += "<td width=\"310px\">" + LR.id.ToString() + "</td>"; ContentStr += "<td width=\"310px\">" + LR.name.ToString() + "</td>"; ContentStr += "<td width=\"130px\">"; ContentStr += "<a href=‘Card_class_Edit.aspx?addoredit=edit&id=" + LR.id.ToString() + @"‘>编辑</a>"; ContentStr += " <a class=\"linkcss\" href=\"#\" onclick=\"javascript:if(confirm(‘确定要删除吗?‘)){DeleMenu(‘" + LR.id.ToString() + "‘);}\" title=\"删除\">删除</a>"; ContentStr += " </td>"; ContentStr += "</tr>"; i++; } } } protected void AspNetPager2_PageChanging(object src, Wuqi.Webdiyer.PageChangingEventArgs e) { DataLoad(e.NewPageIndex); }
AspNetPager是asp.net中常用的分页控件,下载AspNetPager.dll,添加引用,在工具栏就可以看到AspNetPager控件: