Web.config 设置:
<system.web> 下加入:
<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
</httpHandlers>
<httpModules>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</httpModules>
<compilation debug="true" strict="false" explicit="true">
<assemblies>
<add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
</assemblies>
</compilation>
<pages validateRequest="false"> 下加入:
<controls>
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add tagPrefix="webdiyer" namespace="Wuqi.Webdiyer" assembly="AspNetPager"/>
<!--**********使用了AspNetPager7.0 ,故加此句为了方便后面的页面不用再加**************-->
</controls>
*******************Web.config 设置完毕*************************
页面前台:
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
插入 DataList 或别的控件即可,与平时普通操作一样绑定数据
<webdiyer:aspnetpager id="AspNetPager1" runat="server" horizontalalign="Center" width="100%" ShowInputBox="Always" CustomInfoHTML="第%CurrentPageIndex%页,共%PageCount%页,每页显示%PageSize%条"
OnPageChanged="AspNetPager1_PageChanged" NumericButtonTextFormatString="-{0}-" PageIndexBoxType="DropDownList" PageSize="2" ShowBoxThreshold="1" ShowCustomInfoSection="Left"></webdiyer:aspnetpager>
<!--**********使用了AspNetPager7.0 ,这个大家可以根据自己的喜好设置**************-->
</ContentTemplate>
</asp:UpdatePanel>
</div>
后台代码:跟平时写法一样,读取数据,绑定到相应的控件(如 DataList)即可!