天天躁日日躁狠狠躁AV麻豆-天天躁人人躁人人躁狂躁-天天澡夜夜澡人人澡-天天影视香色欲综合网-国产成人女人在线视频观看-国产成人女人视频在线观看

asp.net url分頁類代碼

復制代碼 代碼如下:
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 的摘要說明
/// </summary>
public class CutPage
{
public CutPage()
{
//
//TODO: 在此處添加構造函數邏輯
//
}
#region 私有成員變量
private string url; //分頁時所用到的頁面地址
private int count; //數據總條數
private int pageCount; //總頁數
private int curretPage; //當前頁數
private string id; //接收傳遞參數的值
private int startId; //數據循環的開始值
private int endId; //數據結束的值
private DataTable dt; //數據dt值
private int dataCount; //每頁現實的數據條數
private string cssUrl; //cssURL地址
#endregion
#region 公共變量
/// <summary>
/// Url地址
/// </summary>
public string Url
{
get
{
return url;
}
set
{
this.url = value;
}
}
/// <summary>
/// 數據總條數
/// </summary>
public int Count
{
get
{
return count;
}
set
{
this.count = value;
}
}
/// <summary>
/// 數據總頁數(該字段只讀)
/// </summary>
public int PageCount
{
get
{
if (count % dataCount == 0)
{
return Convert.ToInt32(count / dataCount);
}
else
{
return Convert.ToInt32(count / dataCount) + 1;
}
}
}
/// <summary>
/// 分頁樣式表url
/// </summary>
public string CssUrl
{
get { return cssUrl; }
set { this.cssUrl = value; }
}
/// <summary>
/// 當前頁數
/// </summary>
public int CurretPage
{
get { return this.curretPage; }
set { this.curretPage = value; }
}
/// <summary>
/// 傳遞的參數值
/// </summary>
public string ID
{
get { return this.id; }
set { this.id = value; }
}
/// <summary>
/// 數據開始值(該字段只讀)
/// </summary>
public int StartID
{
get
{
if (curretPage == 1)
{
return 0;
}
else
{
return (curretPage-1) * dataCount;
}
}
}
/// <summary>
/// 數據結束的值(該字段只讀)
/// </summary>
public int EndID
{
get
{
if (CurretPage == PageCount)
{
return this.DT.Rows.Count;
}
else
{
return (curretPage) * dataCount;
}
}
}
/// <summary>
/// 用于分頁的數據源
/// </summary>
public DataTable DT
{
get { return this.dt; }
set { this.dt = value; }
}
/// <summary>
/// 每頁顯示的數據條數
/// </summary>
public int DataCount
{
get { return this.dataCount; }
set { this.dataCount = value; }
}
#endregion
/// <summary>
/// 分頁方法(生成分頁代碼的過程)
/// </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("當前" + CurretPage + "/" + PageCount + "頁 共" + Count + "條數據");
orderInfoSb.Append("</th><th class=/"previous-off/" style=/"align:right/">");
if (Convert.ToInt32(this.ID) == 1)
{
orderInfoSb.Append("<a href='#' disabled='flase'>首頁</a>");
}
else
{
orderInfoSb.Append("<a href='" + Url + "?id=1'>首頁</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'>末頁</a>");
}
else
{
orderInfoSb.Append("<a href='" + Url + "?id="+Convert.ToString(PageCount)+"'>末頁</a>");

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

}
}

樣式大家可以自己添,老實說沒什么技術含量。
前臺代碼:
代碼
復制代碼 代碼如下:
<%@ 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>無標題頁</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>

后臺代碼:
代碼
復制代碼 代碼如下:
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技術asp.net url分頁類代碼,轉載需保留來源!

鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。

主站蜘蛛池模板: 国产在线高清视频 | 116美女写真成人午夜视频 | 亚洲伊人久久大香线蕉综合图片 | 思思久久99热只有频精品66 | 高H高肉强J短篇校园 | 国产成人ae在线观看网站站 | 国产高清视频在线观看97 | 日韩精品免费在线观看 | 国产成人久久婷婷精品流白浆 | 中文字幕 亚洲 有码 在线 | 福利社影院 | 日本三级按摩推拿按摩 | 97影院理论午夜伦不卡偷 | 日本熟妇乱妇熟色在线电影 | 国产人妻人伦精品久久无码 | 国产亚洲欧洲日韩在线观看 | 欧美xxxav| 香蕉视频国产精品 | 91精品视频网站 | 亚洲视频免费在线观看 | 亚洲 自拍 偷拍 另类综合图区 | 办公室韩国电影免费完整版 | 六级黄色片| 她也色在线视频站 | 青青草A在在观免费线观看 青青草AV国产精品 青青草 久久久 | 人人碰国产免费线观看 | BL文库好大粗黑强强肉NP | J午夜精品久久久久久毛片 jzz大全18 | 国产成人无码视频一区二区三区 | 亚洲AV无码乱码A片无码蜜桃 | 亚洲国产果果在线播放在线 | 婷婷亚洲五月色综合久久 | 国产亚洲精品久久久久久入口 | 女厕所边摸边吃奶边做爽视频 | 最新亚洲中文字幕在线观看 | 伊人久久大香线蕉影院95 | 欧美日韩午夜群交多人轮换 | 色淫阁色九九 | 国内精品人妻无码久久久影院蜜桃 | 国产伊人久久 | 亚洲色图在线观看视频 |