如图所示,在AspNetPager傍设置每页显示条数
前台代码
<div class="row"> <div class="span2"> <div class="input-group"> <span class="input-group-addon ie_widthauto">每页显示条数:</span> <asp:TextBox ID="txtPagesize" CssClass="form-control ie_widthauto" runat="server"></asp:TextBox> </div> </div> <div class="span10"> <webdiyer:AspNetPager ID="AspNetPager1" runat="server" NumericButtonCount="6" UrlPaging="false" NumericButtonTextFormatString="[{0}]" CustomInfoHTML="共<span style='color:red;'>%RecordCount%</span>条 - 第%CurrentPageIndex%页 - 显示%StartRecordIndex%-%EndRecordIndex%条" ShowCustomInfoSection="left" FirstPageText="首页" LastPageText="末页" NextPageText="下页" PrevPageText="上页" AlwaysShow="true" showinputbox="Always" SubmitButtonText="跳转" SubmitButtonStyle="botton" HorizontalAlign="Right" OnPageChanged="AspNetPager1_PageChanged" PageSize="10" /> </div> </div>
后台通过cookie设置
Response.Cookies["pagesizi"].Value = txtPagesize.Text; AspNetPager1.PageSize = Convert.ToInt32(Response.Cookies["pagesizi"].Value == "" ? "10" : Response.Cookies["pagesizi"].Value);