日期:2012-06-28  浏览次数:20435 次

listControl.aspx
<%@ Control Language="vb" AutoEventWireup="false" Codebehind="listControl.ascx.vb" Inherits="govoa.listControl" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
共有<asp:Label id="lblRecordCount" ForeColor="red" runat="server" />条记录  当前为<asp:Label id="lblCurrentPage" ForeColor="red" runat="server" />/<asp:Label id="lblPageCount" ForeColor="red" runat="server" />页
<asp:LinkButton id="lblPrevious" runat="server" text="上一页"></asp:LinkButton>
<asp:LinkButton id="lblNext" runat="server" text="下一页"></asp:LinkButton> 
<asp:DropDownList id="NumPerPage" runat="server" AutoPostBack="True">
    <asp:ListItem Value="5">
        5行/页</asp:ListItem>
    <asp:ListItem Value="8" Selected="True">
        8行/页</asp:ListItem>
    <asp:ListItem Value="10">
        10行/页</asp:ListItem>
    <asp:ListItem Value="15">
        15行/页</asp:ListItem>
    <asp:ListItem Value="20">
        20行/页</asp:ListItem>
    <asp:ListItem Value="25">
        25行/页</asp:ListItem>
    <asp:ListItem Value="30">
        30行/页</asp:ListItem>
    <asp:ListItem Value="35">
        35行/页</asp:ListItem>
    <asp:ListItem Value="40">
        40行/页</asp:ListItem>
</asp:DropDownList>
<asp:TextBox ID="txtPage" Runat="server" Width="30"></asp:TextBox><asp:Button ID="btnGo" Runat="server" Text="转到"></asp:Button>



listControl.aspx.vb

Imports System.Data.SqlClient
Public MustInherit Class listControl
    Inherits System.Web.UI.UserControl
    Protected WithEvents lblRecordCount As System.Web.UI.WebControls.Label
    Protected WithEvents lblCurrentPage As System.Web.UI.WebControls.Label
    Protected WithEvents lblPageCount As System.Web.UI.WebControls.Label
    Protected WithEvents lblPrevious As System.Web.UI.WebControls.LinkButton
    Protected WithEvents lblNext As System.Web.UI.WebControls.LinkButton
    Protected WithEvents NumPerPage As System.Web.UI.WebControls.DropDownList
    Protected WithEvents txtPage As System.Web.UI.WebControls.TextBox
    Protected WithEvents btnGo As System.Web.UI.WebControls.Button
    Private m_DataContainer As Repeater
    Private m_datasource As String
    Private m_toRefresh As Boolean = False

    Private MyConn As SqlConnection
    Private RecordCount, PageCount, CurrentPage As Integer


    '/ <summary>
    '/ 取得需要绑定的控件
    '/ </summary>