一个ASP.Net的DataGrid分页控件,在Oracle数据库下,每次只取当前页的数据,不使用存储过程。
2007-12-15 09:31:28 来源:WEB开发网写的不算好,仅供参考。
GridPager.ascx:
<%@ Control Language="c#" AutoEventWireup="false" Codebehind="GridPager.ascx.cs" Inherits="Test.BaseClass.GridPager" TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%><?xml(标准化越来越近了):namespace prefix = asp /><asp:linkbutton id=lbtnPre style="BORDER-RIGHT: white 2px solid; BORDER-LEFT: white 1px solid" runat="server" Text="..." Visible="False"></asp:linkbutton><asp:linkbutton id=lbtnPage1 style="BORDER-RIGHT: white 2px solid; BORDER-LEFT: white 1px solid" runat="server" Text="1" Visible="False" Enabled="False" Font-Size="Small">1</asp:linkbutton> <asp:linkbutton id=lbtnPage2 style="BORDER-RIGHT: white 2px solid; BORDER-LEFT: white 1px solid" runat="server" Text="2" Visible="False"></asp:linkbutton><asp:linkbutton id=lbtnPage3 style="BORDER-RIGHT: white 2px solid; BORDER-LEFT: white 1px solid" runat="server" Text="3" Visible="False"></asp:linkbutton><asp:linkbutton id=lbtnPage4 style="BORDER-RIGHT: white 2px solid; BORDER-LEFT: white 1px solid" runat="server" Text="4" Visible="False"></asp:linkbutton><asp:linkbutton id=lbtnPage5 style="BORDER-RIGHT: white 2px solid; BORDER-LEFT: white 1px solid" runat="server" Text="5" Visible="False"></asp:linkbutton><asp:linkbutton id=lbtnPage6 style="BORDER-RIGHT: white 2px solid; BORDER-LEFT: white 1px solid" runat="server" Text="6" Visible="False"></asp:linkbutton><asp:linkbutton id=lbtnPage7 style="BORDER-RIGHT: white 2px solid; BORDER-LEFT: white 1px solid" runat="server" Text="7" Visible="False"></asp:linkbutton><asp:linkbutton id=lbtnPage8 style="BORDER-RIGHT: white 2px solid; BORDER-LEFT: white 1px solid" runat="server" Text="8" Visible="False"></asp:linkbutton><asp:linkbutton id=lbtnPage9 style="BORDER-RIGHT: white 2px solid; BORDER-LEFT: white 1px solid" runat="server" Text="9" Visible="False"></asp:linkbutton><asp:linkbutton id=lbtnPage10 style="BORDER-RIGHT: white 2px solid; BORDER-LEFT: white 1px solid" runat="server" Text="10" Visible="False"></asp:linkbutton><asp:linkbutton id=lbtnNext style="BORDER-RIGHT: white 2px solid; BORDER-LEFT: white 1px solid" runat="server" Text="..." Visible="False"></asp:linkbutton>
///////////////////////////////////////////////////////////////////////////////////////
GridPager.ascx.cs:
using System;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.UI.WebControls;
namespace Test.BaseClass
{
public class GridPager : System.Web.UI.UserControl
{
#region 类变量
protected System.Web.UI.WebControls.LinkButton lbtnNext;
protected System.Web.UI.WebControls.LinkButton lbtnPage10;
protected System.Web.UI.WebControls.LinkButton lbtnPage9;
protected System.Web.UI.WebControls.LinkButton lbtnPage8;
更多精彩
赞助商链接