zoukankan      html  css  js  c++  java
  • aspnetpager分页控件的使用 dodo

    1.页面调用
    <%@ Register TagPrefix="cc1" Namespace="Pager" Assembly="Pager" %><%@ Register TagPrefix="cc1" Namespace="Pager" Assembly="Pager" %><%@ Register TagPrefix="cc1" Namespace="Pager" Assembly="Pager" %>
    <cc1:aspnetpager id="AspNetPager" Visible="False" runat="server" Width="100%" CustomInfoClass="subhead" ShowCustomInfoSection="Right" NumericButtonCount="10" PageSize="5">
    2.
    设置属性信息
                Dim intPageCount As Integer = intRows * intColumns

                If Not Page.IsPostBack Then
                    Me.AspNetPager.PageSize = intPageCount
                End If

     Me.AspNetPager.RecordCount = intTotalCount

                Me.AspNetPager.CustomInfoText = "记录总数:<font color=blue><b>" & Me.AspNetPager.RecordCount.ToString() & "</b></font>"

                Me.AspNetPager.CustomInfoText &= " 总页数:<font color=blue><b>" & Me.AspNetPager.PageCount.ToString() & "</b></font>"

                Me.AspNetPager.CustomInfoText &= " 当前页:<font color=red><b>" & Me.AspNetPager.CurrentPageIndex.ToString() & "</b></font>"

    事件:
    Private Sub AspNetPager_PageChanged(ByVal src As System.Object, ByVal e As Pager.PageChangedEventArgs) Handles AspNetPager.PageChanged
                AspNetPager.CurrentPageIndex = e.NewPageIndex
                BindData()
            End Sub

    3.编写分页的存储过程
    CREATE PROCEDURE aaa_GetPagebbb
    @PageSize int,
    @CurrentPage int,
    @ModuleId int

     AS

    --声明要执行的SQL字符串变量
    declare @sqlstring  nvarchar(2000)

    set @sqlstring= N'

    --临时表
    declare @indextable table(id int identity(1,1),nid int )

    --当前页面的编号
    declare @PageLowerBound int

    declare @PageUpperBound int

    set @PageLowerBound = (' + cast(@CurrentPage as nvarchar) +  '-1)*' + cast(@PageSize as nvarchar) + '

    set @PageUpperBound =@PageLowerBound +' + cast(@PageSize as nvarchar) + '

    --往临时表中写入ID编号
    insert into @indextable(nid) select bbbID from bbb '  + '

    select count(*) from @indextable  '

    + '
    select *  '

    set @sqlstring = @sqlstring  +  '
      from bbb, @indextable as t  where bbb.bbbID = t.nid '

    if @PageSize <> 0
    --@PageSize = 0 表示读取所有信息
    begin
    set @sqlstring = @sqlstring + 'and t.id > @PageLowerBound and t.id <= @PageUpperBound '
    end

    set @sqlstring = @sqlstring  + 'order by t.id '

    print(@sqlstring)

    exec (@sqlstring)
    (切莫忘了最后执行的语句())
    GO

  • 相关阅读:
    (八)断路器-Hystrix
    WINDOWS SERVER 2012 虚拟机 忘记密码后
    IIS FTP :在组合的密钥属性“users,roles,permissions”分别设置为“*,Read,Write”时,无法添加类型为“add”的重复集合项
    log4j 日志组件
    IDEA缓存
    com.alibaba.druid.pool.DruidDataSource
    EHCache CacheManager
    webservice调试(XML参数) Wizdler PostMan
    jar类库加载顺序
    JAXB工具
  • 原文地址:https://www.cnblogs.com/zgqys1980/p/455527.html
Copyright © 2011-2022 走看看