朱哥研究出来的分页控件

昨天刚向朱哥学了ajax迅速实现分页的方法:
用到了两个文件:
http://files.cnblogs.com/gengxiaochao/分页用的文件.rar

在解决方案下的项目名上右键添加引用-浏览-把这两个文件引用进去,在左面的工具箱-AJAX Extensions右键-选择项-浏览-在Bin中找到AspNetPager.dll打开-AJAX Extensions中就有了AspNetPager控件
拖拽使用生成 :

修改为:
   < webdiyer:AspNetPager  ID ="AspNetPager1"  runat ="server"  AlwaysShow ="True"  OnPageChanged ="AspNetPager1_PageChanged"
                                UrlPaging
="True" >
        
</ webdiyer:AspNetPager >
在后台代码:

protected   void  Page_Load( object  sender, EventArgs e)
    
{
        AspNetPager1.RecordCount 
= (int)Socut.Data.ExecuteScalar("select count(*) from table");
    }

    
public   void  Bind()
    
{
        DataSet sea 
= Socut.Data.ExecuteDataSet("select * from table", AspNetPager1.PageSize * (AspNetPager1.CurrentPageIndex - 1), AspNetPager1.PageSize);
        GridView1.DataSource 
= sea;
        GridView1.DataBind();
    }

    
protected   void  AspNetPager1_PageChanged( object  sender, EventArgs e)
    
{
        Bind();
    }
指定了控件给GridView1分页。
Web.config里修改了<appSettings>和<compilation debug="true">
<? xml version="1.0" encoding="utf-8" ?>
<!--  
    注意: 除了手动编辑此文件以外,您还可以使用 
    Web 管理工具来配置应用程序的设置。可以使用 Visual Studio 中的
     “网站”->“Asp.Net 配置”选项。
    设置和注释的完整列表在 
    machine.config.comments 中,该文件通常位于 
    \Windows\Microsoft.Net\Framework\v2.x\Config 中
-->
< configuration >
  
< appSettings >
    
< add  key ="SocutDataLink"  value ="Server=SEA\SQLEXPRESS;Initial Catalog=sea;Integrated Security=True" />
  
</ appSettings >
    
    
< connectionStrings >
        
< add  name ="seaConnectionString1"  connectionString ="Data Source=SEA\SQLEXPRESS;Initial Catalog=sea;Integrated Security=True"
            providerName
="System.Data.SqlClient"   />
    
</ connectionStrings >
    
< system .web >
        
<!--  
            设置 compilation debug="true" 将调试符号插入
            已编译的页面中。但由于这会 
            影响性能,因此只在开发过程中将此值 
            设置为 true。
        
-->
      
< compilation  debug ="true" >
        
< assemblies >
          
< add  assembly ="System.Web.Extensions.Design, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
          
< add  assembly ="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
          
< add  assembly ="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
        
</ assemblies >
      
        
<!--
            通过 <authentication> 节可以配置 ASP.NET 使用的 
            安全身份验证模式,
            以标识传入的用户。 
        
-->
      
</ compilation >
        
< authentication  mode ="Forms"   />
        
<!--
            如果在执行请求的过程中出现未处理的错误,
            则通过 <customErrors> 节可以配置相应的处理步骤。具体说来,
            开发人员通过该节可以配置
            要显示的 html 错误页
            以代替错误堆栈跟踪。

        <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
            <error statusCode="403" redirect="NoAccess.htm" />
            <error statusCode="404" redirect="FileNotFound.htm" />
        </customErrors>
        
-->
    
</ system.web >
</ configuration >


向数据库插入十万条数据:
   DECLARE     @VA     INT   
set   @VA = 1
  
WHILE     @VA < 100000   
  
BEGIN   
  
INSERT     INTO     [ sea ]     VALUES ( @VA )  
set   @VA = @VA + 1
  
END    
控件瞬间完成了分页。

转载于:https://www.cnblogs.com/gengxiaochao/archive/2007/09/18/896827.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值