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

  • 相关阅读:
    常见数据结构图文详解-C++版
    求单链表中环的起点,原理详解
    Qt Creator 整合 python 解释器教程
    Qt 共享库(动态链接库)和静态链接库的创建及调用
    qt creator 中的"提升为..."功能简介
    QT 操作 excel 教程
    网易2017校园招聘算法题c语言实现源码
    c语言版贪吃蛇小游戏
    mysql语法结构
    Spring MVC rest接收json中文格式数据显示乱码
  • 原文地址:https://www.cnblogs.com/zgqys1980/p/455527.html
Copyright © 2011-2022 走看看