一区二区久久-一区二区三区www-一区二区三区久久-一区二区三区久久精品-麻豆国产一区二区在线观看-麻豆国产视频

asp.net url分頁(yè)類(lèi)代碼

復(fù)制代碼 代碼如下:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Text;

/// <summary>
///CutPage 的摘要說(shuō)明
/// </summary>
public class CutPage
{
public CutPage()
{
//
//TODO: 在此處添加構(gòu)造函數(shù)邏輯
//
}
#region 私有成員變量
private string url; //分頁(yè)時(shí)所用到的頁(yè)面地址
private int count; //數(shù)據(jù)總條數(shù)
private int pageCount; //總頁(yè)數(shù)
private int curretPage; //當(dāng)前頁(yè)數(shù)
private string id; //接收傳遞參數(shù)的值
private int startId; //數(shù)據(jù)循環(huán)的開(kāi)始值
private int endId; //數(shù)據(jù)結(jié)束的值
private DataTable dt; //數(shù)據(jù)dt值
private int dataCount; //每頁(yè)現(xiàn)實(shí)的數(shù)據(jù)條數(shù)
private string cssUrl; //cssURL地址
#endregion
#region 公共變量
/// <summary>
/// Url地址
/// </summary>
public string Url
{
get
{
return url;
}
set
{
this.url = value;
}
}
/// <summary>
/// 數(shù)據(jù)總條數(shù)
/// </summary>
public int Count
{
get
{
return count;
}
set
{
this.count = value;
}
}
/// <summary>
/// 數(shù)據(jù)總頁(yè)數(shù)(該字段只讀)
/// </summary>
public int PageCount
{
get
{
if (count % dataCount == 0)
{
return Convert.ToInt32(count / dataCount);
}
else
{
return Convert.ToInt32(count / dataCount) + 1;
}
}
}
/// <summary>
/// 分頁(yè)樣式表url
/// </summary>
public string CssUrl
{
get { return cssUrl; }
set { this.cssUrl = value; }
}
/// <summary>
/// 當(dāng)前頁(yè)數(shù)
/// </summary>
public int CurretPage
{
get { return this.curretPage; }
set { this.curretPage = value; }
}
/// <summary>
/// 傳遞的參數(shù)值
/// </summary>
public string ID
{
get { return this.id; }
set { this.id = value; }
}
/// <summary>
/// 數(shù)據(jù)開(kāi)始值(該字段只讀)
/// </summary>
public int StartID
{
get
{
if (curretPage == 1)
{
return 0;
}
else
{
return (curretPage-1) * dataCount;
}
}
}
/// <summary>
/// 數(shù)據(jù)結(jié)束的值(該字段只讀)
/// </summary>
public int EndID
{
get
{
if (CurretPage == PageCount)
{
return this.DT.Rows.Count;
}
else
{
return (curretPage) * dataCount;
}
}
}
/// <summary>
/// 用于分頁(yè)的數(shù)據(jù)源
/// </summary>
public DataTable DT
{
get { return this.dt; }
set { this.dt = value; }
}
/// <summary>
/// 每頁(yè)顯示的數(shù)據(jù)條數(shù)
/// </summary>
public int DataCount
{
get { return this.dataCount; }
set { this.dataCount = value; }
}
#endregion
/// <summary>
/// 分頁(yè)方法(生成分頁(yè)代碼的過(guò)程)
/// </summary>
/// <param name="PageInfo">Literal控件 </param>
public void CutPageMethod(Literal pt)
{
StringBuilder orderInfoSb = new StringBuilder();
orderInfoSb.Append("<span style=/"width:1000px/"><tr id=/"pagination-digg/"><th style=/"width:180px/">");
orderInfoSb.Append("當(dāng)前" + CurretPage + "/" + PageCount + "頁(yè) 共" + Count + "條數(shù)據(jù)");
orderInfoSb.Append("</th><th class=/"previous-off/" style=/"align:right/">");
if (Convert.ToInt32(this.ID) == 1)
{
orderInfoSb.Append("<a href='#' disabled='flase'>首頁(yè)</a>");
}
else
{
orderInfoSb.Append("<a href='" + Url + "?id=1'>首頁(yè)</a>");
}
orderInfoSb.Append("</th><th>");
if (Convert.ToInt32(this.ID )== 1 || this.ID==null || this.ID==string.Empty)
{
orderInfoSb.Append("<a href='#'disabled='flase'></a>");
}
else
{
orderInfoSb.Append("<a href='" + Url + "?id="+Convert.ToString(CurretPage-1)+"'></a>");
}
if (Convert.ToInt32(this.ID) < PageCount)
{
orderInfoSb.Append("<a href='" + Url + "?id=" +Convert.ToString(CurretPage + 1) + "'></a>");

}
else
{
orderInfoSb.Append("<a href='#'disabled='flase'></a>");
}
orderInfoSb.Append("</th><th>");
if (Convert.ToInt32(this.ID) == PageCount)
{
orderInfoSb.Append("<a href='#' disabled='flase'>末頁(yè)</a>");
}
else
{
orderInfoSb.Append("<a href='" + Url + "?id="+Convert.ToString(PageCount)+"'>末頁(yè)</a>");

}
orderInfoSb.Append("</th></tr></span>");
pt.Text = orderInfoSb.ToString();

}
}

樣式大家可以自己添,老實(shí)說(shuō)沒(méi)什么技術(shù)含量。
前臺(tái)代碼:
代碼
復(fù)制代碼 代碼如下:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="CutPageTest.ASPx.cs" Inherits="CutPageTest" EnableViewState="false"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server" id="had">
<%--<link href="Style/Base.css" type="text/css" />--%>

<title>無(wú)標(biāo)題頁(yè)</title>
<style type="text/css">
a
{
text-decoration: none;

}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<ASP:Literal ID="LiInfo" runat="server"></ASP:Literal>
<ASP:Literal ID="lt" runat="server"></ASP:Literal>
<a href="#"
</div>
</form>
</body>
</html>

后臺(tái)代碼:
代碼
復(fù)制代碼 代碼如下:
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

public partial class CutPageTest : System.Web.UI.Page
{
CutPage cp=new CutPage();
string id;
protected void Page_Load(object sender, EventArgs e)
{
ShowPageData(DbHelperSQL.QueryReDt("select * from test",GlobalConfig.TCCLineDbHelper), "CutPageTest.ASPx");
//Response.Write();

}
public void ShowPageData(DataTable dt,string url)
{
//cp.CssUrl = "Style/PageCut.css";
id = Request.QueryString["id"];
cp.ID = id;
cp.DT = dt;
had.InnerHtml = "<link href=/"css/text/" src='" + cp.CssUrl + "'/>";
if (id == null || id == "")
{
cp.CurretPage = 1;
}
else
{
cp.CurretPage = Convert.ToInt32(id);
}
cp.Url = url;
cp.DataCount = 2;
cp.Count = cp.DT.Rows.Count;
cp.CutPageMethod(lt);
for (int i = cp.StartID; i < cp.EndID; i++)
{
LiInfo.Text += cp.DT.Rows[i][1].ToString() + "<br/>";
}
}
}

AspNet技術(shù)asp.net url分頁(yè)類(lèi)代碼,轉(zhuǎn)載需保留來(lái)源!

鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請(qǐng)第一時(shí)間聯(lián)系我們修改或刪除,多謝。

主站蜘蛛池模板: 伊人小婷婷色香综合缴缴情 | 在线免费福利 | 一本色道 | 午夜在线观看视频在线播放版 | 六月丁香婷婷网 | 欧美高清亚洲欧美一区h | 天天做.天天爱.天天综合网 | 日本国产最新一区二区三区 | 九九视频热 | 欧美综合图片 | 国产精品视_精品国产免费 国产精品视频1区 | 国产第一夜 | 日本网络视频www色高清免费 | 国产精品免费观看 | 女人被爽到呻吟娇喘的视频动态图 | 亚洲天堂一区二区三区四区 | 亚洲卡5卡6卡7国色天香 | 色婷亚洲| 精品乱人伦一区二区三区 | 国产午夜视频在线观看第四页 | 15p亚洲 | 好吊妞视频在线观看 | 男人插女人视频网站 | 色在线网站 | 午夜色大片在线观看 | 在线成人爽a毛片免费软件 在线成人小视频 | 国语自产免费精品视频一区二区 | 福利影院在线看 | 国产床戏无遮挡免费观看网站 | 婷婷综合影院 | 国产午夜精品一区二区 | 国产视频一区二区三区四区 | 伊人国产视频 | 38pao强力打造永久免费高清视频 | 91天堂97年嫩模在线观看 | 一级做a爰片性色毛片黄书 一级做a爰片性色毛片男 | 日产一一到六区麻豆 | 久久久噜噜噜久久 | 亚洲综合偷自成人网第页色 | 综合 91在线精品 | 国产91成人精品亚洲精品 |