QQRead:http://www.qqread.com/dotnet/w224310.html
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: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>
Public Property GetRelatedControl() As Repeater
Get
Return m_DataContainer
End Get
Set(ByVal Value As Repeater)
m_DataContainer = Value
End Set
End Property
Public Property ToRefresh() As Boolean
Get
Return m_toRefresh
End Get
Set(ByVal Value As Boolean)
m_toRefresh = Value
End Set
End Property
Public Property GetRelatedSqlStr() As String
Get
Return m_datasource
End Get
Set(ByVal Value As String)
m_datasource = Value
If m_toRefresh Then
refreshData()
End If
End Set
End Property
#Region " Web 窗体设计器生成的代码 "
'该调用是 Web 窗体设计器所必需的。
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: 此方法调用是 Web 窗体设计器所必需的
'不要使用代码编辑器修改它。
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'在此处放置初始化页的用户代码
MyConn = New SqlConnection(System.Configuration.ConfigurationSettings.AppSettings("ConnectionString"))
MyConn.Open()
ViewState("PageSize") = NumPerPage.SelectedItem.Value.ToString()
If Not Page.IsPostBack Then
BindControl()
CurrentPage = 0
ViewState("PageIndex") = 0
'计算总共有多少记录
&进入讨论组讨论。
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: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>
Public Property GetRelatedControl() As Repeater
Get
Return m_DataContainer
End Get
Set(ByVal Value As Repeater)
m_DataContainer = Value
End Set
End Property
Public Property ToRefresh() As Boolean
Get
Return m_toRefresh
End Get
Set(ByVal Value As Boolean)
m_toRefresh = Value
End Set
End Property
Public Property GetRelatedSqlStr() As String
Get
Return m_datasource
End Get
Set(ByVal Value As String)
m_datasource = Value
If m_toRefresh Then
refreshData()
End If
End Set
End Property
#Region " Web 窗体设计器生成的代码 "
'该调用是 Web 窗体设计器所必需的。
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: 此方法调用是 Web 窗体设计器所必需的
'不要使用代码编辑器修改它。
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'在此处放置初始化页的用户代码
MyConn = New SqlConnection(System.Configuration.ConfigurationSettings.AppSettings("ConnectionString"))
MyConn.Open()
ViewState("PageSize") = NumPerPage.SelectedItem.Value.ToString()
If Not Page.IsPostBack Then
BindControl()
CurrentPage = 0
ViewState("PageIndex") = 0
'计算总共有多少记录
&进入讨论组讨论。
相关图文阅读
频道图文推荐
健 康 咨 询
时 尚 咨 询
相关专题
- VB.NET 入门教程 (22167次浏览)
- asp.net 实现购物车详细代码 (14312次浏览)
- C#版的网站新闻发布系统 (690次浏览)
- ASP.NET2.0轻松搞定统计图表 (651次浏览)
- 使用ASP.NET AJAX实现幻灯片效果 (604次浏览)
- ASP.NET如何存取 SQLServer数据库图片 (592次浏览)
- 如何制作Asp.Net界面模板 (582次浏览)
- ASP.NET中实现DataGrid数据排序 (580次浏览)
- VB.NET读写文本文件方法 (579次浏览)
- VC#初学入门:第一个Windows程序 (536次浏览)



