程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> .NET網頁編程 >> ASP.NET >> ASP.NET基礎 >> asp.net Repeater之非常好的數據分頁

asp.net Repeater之非常好的數據分頁

編輯:ASP.NET基礎
分頁控件源代碼如下:
復制代碼 代碼如下:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections;

#region Assembly Resource Attribute
[assembly: System.Web.UI.WebResource("WebControlLibrary.Js.AjaxHelper.js", "text/javascript")]
[assembly: System.Web.UI.WebResource("WebControlLibrary.img.bg_pager.png", "image/gif")]
#endregion

namespace WebControlLibrary
{
/// <summary>
/// Repeater分頁控件可進行Ajax分頁(但Ajax分頁不能傳參數)
/// </summary>
[DefaultProperty("Text")]
[ToolboxData("<{0}:RepeaterPages runat=server></{0}:RepeaterPages>")]
public class RepeaterPages : WebControlLibrary.Repeater
{
// <summary>
/// 構造函數
/// </summary>
public RepeaterPages()
: base()
{

}

/// <summary>
/// 下一頁分頁文本內容
/// </summary>
private string _NextPage = ">";

/// <summary>
/// 下一頁標記
/// </summary>
[Bindable(false), Description("下一頁標記所顯示的文本內容")]
public string NextPage
{
get { return _NextPage; }

set { _NextPage = value; }
}

/// <summary>
/// 下一頁標記
/// </summary>
private string _LastPage = "<";

/// <summary>
/// 上一頁標記
/// </summary>
[Bindable(false), Description("上一頁標記所顯示的文本內容")]
public string LastPage
{
get { return _LastPage; }

set { _LastPage = value; }
}

/// <summary>
/// 總記錄數屬性
/// </summary>
private int _RecordCount;

/// <summary>
/// 頁面分頁大小屬性
/// </summary>
private int _PageSize;

/// <summary>
/// 當前頁數
/// </summary>
private int _CurrentPage;

/// <summary>
/// 返回總頁面
/// </summary>
private int _AllPages;

/// <summary>
/// 頁面地址
/// </summary>
private string _Url;

/// <summary>
/// 傳入Sql語句
/// </summary>
private string _SqlString;

/// <summary>
/// 每頁顯示頁碼數
/// </summary>
private int _PageNumberCount;

/// <summary>
/// 數據庫中顯示的字段列表
/// </summary>
private string _ShowTableCollName;

/// <summary>
/// 記錄數屬性
/// </summary>
[Bindable(true), Category("Appearance"), DefaultValue("0")]
private int RecordCount
{
get
{
int IntTempValue = 0;
if (Int32.TryParse(Sql_Function.SqlDb.RecordCounts(SqlString), out IntTempValue))
return IntTempValue;
else
return 0;
}
set
{
_RecordCount = value;
}
}

/// <summary>
/// 每頁分頁大小屬性
/// </summary>
[Bindable(true), Category("Appearance"), DefaultValue("50"), Description("每頁分頁大小屬性")]
public int PageSize
{
get
{
if (_PageSize == 0 || _PageSize.ToString() == "" || _PageSize > 200)
{
return 50;
}
else if (Sql_Function.PublicFunction.isNumber(_PageSize.ToString()))
{
return 50;
}
else if (_PageSize <= 0)
{
return 50;
}
else if (_PageSize > 200)
{
return 50;
}
else
{
return _PageSize;
}
}

set { _PageSize = value; }
}

/// <summary>
/// 每頁顯示的頁碼個數
/// </summary>
[Bindable(true), Category("Appearance"), DefaultValue("5"), Description("每頁顯示的頁碼個數")]
public int PageNumberCount
{
get
{
if (_PageNumberCount == 0 || _PageNumberCount.ToString() == "" || _PageNumberCount > 30)
{
return 5;
}
else if (Sql_Function.PublicFunction.isNumber(_PageNumberCount.ToString()))
{
return 5;
}
else if (_PageNumberCount <= 0)
{
return 5;
}
else if (_PageNumberCount > 30)
{
return 5;
}
else
{
return _PageNumberCount;
}
}

set { _PageNumberCount = value; }
}

/// <summary>
/// 返回總頁數
/// </summary>
private int AllPages
{
get
{
int totalpage;

if (RecordCount / PageSize == 0)
{
totalpage = RecordCount / PageSize;
}
else
{
totalpage = RecordCount / PageSize + 1;
}

return totalpage;
}

set { _AllPages = value; }
}

/// <summary>
/// 當前頁數
/// </summary>
private int CurrentPage
{
get
{
string RequestCurrentPage = System.Web.HttpContext.Current.Request["page"];

#region 計算當前頁數

int result_currentpage = 1;

if (RequestCurrentPage == null)///指地址欄中沒有PAGE字符
{
result_currentpage = 1;
}

if (RequestCurrentPage != null)
{

if (RequestCurrentPage.Length > 10 || RequestCurrentPage.Length < 1)///防止Convert.ToInt32拋出異常或者防止地址欄所得到的page=這樣的值
{
result_currentpage = 1;
}
else///是數值
{
if (Sql_Function.PublicFunction.isNumber(RequestCurrentPage))// 判斷是否為數值
{
result_currentpage = 1;
}
else
{
if (Convert.ToInt32(RequestCurrentPage) > AllPages)///是否大於總頁數
{
result_currentpage = 1;
}
else
{
if (Convert.ToInt32(RequestCurrentPage) <= 1)///是否小於頁數1
{
result_currentpage = 1;
}
else
{
result_currentpage = Convert.ToInt32(RequestCurrentPage);
}
}
}
}
}
else
{
result_currentpage = 1;
}

return result_currentpage;

#endregion

}

set { _CurrentPage = value; }
}

/// <summary>
/// 用於分頁所顯示URL參數鏈接(完整的URL參數)
/// </summary>
[Bindable(false), Description("用於分頁所顯示URL參數鏈接(完整的URL參數)")]
public string Url
{
get
{
if (_Url == null || _Url.ToString() == "")
{
return "?";
}
else
{
if (_Url.IndexOf("?") == -1)
{
string a = "?";

a = a + _Url;

return a;
}
else if (Convert.ToInt32(StringFindCount(_Url, "?")) > 1)//如果含有多個?號
{
return "?";
}
else
{
return _Url;
}

}
}

set { _Url = value; }
}

/// <summary>
/// 傳入Sql語句
/// </summary>
[Bindable(false), Description("傳入統計記錄總數的Sql語句 例如:select count(id) from tablename")]
public string SqlString
{
get
{
if (_SqlString == null || _SqlString.ToString() == "" || _SqlString.Length < 15)
{
return "";
}
else
{
return _SqlString;
}
}

set { _SqlString = value; }
}

/// <summary>
/// 數據庫中顯示的字段列表
/// </summary>
[Bindable(false), Description("數據庫中顯示的字段列表 多個字段中間用逗號隔開")]
public string ShowTableCollName
{
get
{
if (_ShowTableCollName == null || _ShowTableCollName == "")
{
return "*";
}
else
{
return _ShowTableCollName;
}
}

set { _ShowTableCollName = value; }
}

/// <summary>
/// 分頁信息前和尾所包含的HTML代碼
/// </summary>
private string _PageBeforeHtml;

/// <summary>
/// 分頁信息前和尾所包含的HTML代碼
/// </summary>
private string _PageLastHtml;

/// <summary>
/// 分頁信息前和尾所包含的HTML代碼
/// </summary>
[Bindable(false), Description("分頁信息前和尾所包含的HTML代碼 ")]
public string PageBeforeHtml
{
get { return _PageBeforeHtml; }

set { _PageBeforeHtml = value; }
}

/// <summary>
/// 分頁信息前和尾所包含的HTML代碼
/// </summary>
[Bindable(false), Description("分頁信息前和尾所包含的HTML代碼 ")]
public string PageLastHtml
{
get { return _PageLastHtml; }

set { _PageLastHtml = value; }
}

/// <summary>
/// 調用的樣式
/// </summary>
private string _Css = "";

/// <summary>
/// 調用的樣式
/// </summary>
[Bindable(false), Category("Behavior"), DefaultValue("默認樣式"), TypeConverter(typeof(WebPageCssSelect)), Description("分頁樣式")]
public string Css
{
get { return _Css; }

set { _Css = value; }
}

/// <summary>
/// 是否為分頁加上快捷輸入框輸入數值回車導航分頁
/// </summary>
private bool _SelectPage = true;

/// <summary>
/// 是否為分頁加上快捷輸入框輸入數值回車導航分頁
/// </summary>
[Bindable(false), Description("是否為分頁加上快捷輸入框輸入數值回車導航分頁")]
public bool SelectPage
{
get { return _SelectPage; }

set { _SelectPage = value; }
}

/// <summary>
/// 分頁顯示對齊方式
/// </summary>
private string _AlignSorts = "right";

/// <summary>
/// 分頁顯示對齊方式
/// </summary>
[Bindable(false), DefaultValue("right"), TypeConverter(typeof(WebPageAlign)), Description("分頁顯示對齊方式")]
public string AlignSorts
{
get { return _AlignSorts; }

set { _AlignSorts = value; }
}

/// <summary>
/// 分頁Js分頁函數調用名稱
/// </summary>
private string _JsFunctionName = "_doPostBack";

/// <summary>
/// 分頁Js分頁函數調用名稱
/// </summary>
[Bindable(false), Description("分頁Js分頁函數調用名稱")]
public string JsFunctionName
{
get
{
if (_JsFunctionName == null || _JsFunctionName.Replace("'", "").Replace("\"", "") == "")
{
return "_doPostBack";
}
else
{
return _JsFunctionName;
}
}

set { _JsFunctionName = value; }
}

/// <summary>
/// 是否啟用簡潔分頁樣式
/// </summary>
private bool _AutoPageConcise = false;

/// <summary>
/// 是否啟用簡潔分頁樣式
/// </summary>
[Bindable(false), Description("是否啟用簡潔分頁樣式")]
public bool AutoPageConcise
{
set { _AutoPageConcise = value; }

get { return _AutoPageConcise; }
}

/// <summary>
/// 是否允許無刷新調用分頁
/// </summary>
private bool _BoolIsAutoAjaxPage = false;

/// <summary>
/// 是否允許無刷新調用分頁
/// </summary>
[Bindable(false), Description("是否允許無刷新調用分頁")]
public bool BoolIsAutoAjaxPage
{
get { return _BoolIsAutoAjaxPage; }

set { _BoolIsAutoAjaxPage = value; }
}

/// <summary>
/// 無刷新調用的頁面或自定義控件頁面ascx分頁信息頁 完整路徑
/// </summary>
private string _AutoAjaxPageUrl = "";

/// <summary>
/// 無刷新調用的頁面或自定義控件頁面ascx分頁信息頁 完整路徑
/// </summary>
[Bindable(false), Description("無刷新調用的頁面或自定義控件頁面ascx分頁信息頁 完整路徑")]
public string AutoAjaxPageUrl
{
get { return _AutoAjaxPageUrl; }

set { _AutoAjaxPageUrl = value; }
}

/// <summary>
/// 用於無刷新中間級異步調用分頁信息頁面的中間層頁面地址
/// </summary>
private string _AutoAjaxReturnPageUrl = "";

/// <summary>
/// 用於無刷新中間級異步調用分頁信息頁面的中間層頁面地址
/// </summary>
[Bindable(false), Description("用於無刷新中間級異步調用分頁信息頁面的中間層頁面地址")]
public string AutoAjaxReturnPageUrl
{
get { return _AutoAjaxReturnPageUrl; }

set { _AutoAjaxReturnPageUrl = value; }
}

/// <summary>
/// 無刷新調用的頁面所返回的控件ID
/// </summary>
private string _AutoAjaxPageWebControl = "";

/// <summary>
/// 無刷新調用的頁面所返回的控件ID
/// </summary>
[Bindable(false), Description("無刷新調用的頁面所返回的控件ID")]
public string AutoAjaxPageWebControl
{
get { return _AutoAjaxPageWebControl; }

set { _AutoAjaxPageWebControl = value; }
}

/// <summary>
/// 輸出html,在浏覽器中顯示控件
/// </summary>
/// <param name="output"> 要寫出到的 HTML 編寫器 </param>
protected override void Render(HtmlTextWriter output)
{
base.Render(output);

if (!this.Page.ClientScript.IsClientScriptBlockRegistered(this.Page.GetType(), "AjaxPageJs"))
{
output.Write("\n<script type=\"text/javascript\">var AjaxUrl='" + AutoAjaxReturnPageUrl + "';</script>");

output.Write("\n<script type=\"text/javascript\" src=\"" + this.Page.ClientScript.GetWebResourceUrl(this.GetType(), "WebControlLibrary.Js.AjaxHelper.js") + "\"></script>");

this.Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "AjaxPageJs", "");
}

#region 輸出分頁鏈接樣式

string CssInfo = WebPageCss.CssStyle(Css, AlignSorts, this.Page.ClientScript.GetWebResourceUrl(this.GetType(), "WebControlLibrary.img.bg_pager.png"));

output.WriteLine(CssInfo);

#endregion

#region 輸出分頁Js

output.WriteLine("<script language=\"JavaScript\">\n");

output.WriteLine(" function " + JsFunctionName + "(Obj,PageIndex)\n");

output.WriteLine(" {\n");

if (BoolIsAutoAjaxPage)
{
output.WriteLine(" AjaxHelper.Updater('" + AutoAjaxPageUrl.Replace("'", "").Replace("\"", "") + "','" + AutoAjaxPageWebControl + "','" + System.Web.HttpContext.Current.Request.ServerVariables["QUERY_STRING"] + "&page=' + PageIndex + '');\n");

}
else
{
output.WriteLine(" var getUrl=\"" + Url.Replace("'", "").Replace("\"", "") + "&page=\" + PageIndex + \"\";\n");

output.WriteLine(" document.location.href=getUrl;\n");
}

output.WriteLine(" }\n");

output.WriteLine("</script>\n");

#endregion

if (!DesignMode)
{
string Result = Pagination();

if (RecordCount > PageSize)
{
output.WriteLine(Result);
}
}
}

/// <summary>
/// 調用存儲過程返回數據集
/// </summary>
/// <param name="IsProc">是否啟用存儲過程調用數據 true:啟用</param>
/// <param name="PorcedureName">存儲過程名</param>
/// <param name="TableName">表名</param>
/// <param name="TableCollName">表中該列來進行分頁(必須是唯一性的字符,比如標識種子</param>
/// <param name="OrderBy">完整的排序字段值 不需要order by </param>
/// <param name="Where">存儲過程分頁中的條件 不需要Where</param>
/// <returns></returns>
public System.Data.DataTable getObjectRecordCount(bool IsProc, string PorcedureName, string TableName, string TableCollName, string OrderBy, string Where)
{
System.Data.DataTable DataTables = new System.Data.DataTable();

if (IsProc)
{
DataTables = Sql_Function.SqlDb.ReturnDataTable("" + PorcedureName + " '" + TableName + "','" + TableCollName + "'," + CurrentPage + "," + PageSize + ",'" + ShowTableCollName.Replace("'", "") + "','" + OrderBy + "','" + Where + "'");
}
else//普通分頁
{
string StrSql = string.Format("select {0} from {1} where {2} is not null", ShowTableCollName, TableName, TableCollName);

if (Where != null && Where.Trim().Replace("'", "") != "")
{
StrSql += " and " + Where.Trim().Replace("'", "");
}

if (OrderBy != null && OrderBy.Trim().Replace("'", "") != "")
{
StrSql += " order by " + OrderBy.Trim().Replace("'", "");
}

try
{
DataTables = Sql_Function.SqlDb.ReturnDataTablePage(StrSql, CurrentPage, PageSize, "ReturnDataTable");
}
catch
{
DataTables = null;
}
}

return DataTables;
}

/// <summary>
/// 分頁函數
/// </summary>
/// <param name="TotalRecordCount">總記錄數</param>
/// <param name="Url">Url地址</param>
/// <param name="CurrentPage">當前頁數</param>
public string Pagination()
{
int allpage = 0;//總頁數

int next = 0;//下頁標記

int pre = 0;//上一頁標記

int startcount = 0;//開始頁碼數

int endcount = 0;//結束頁碼數

string pagestr = "";//返回分頁結果集

if (CurrentPage < 1) { CurrentPage = 1; }

//計算總頁數
if (PageSize != 0)
{
allpage = (RecordCount / PageSize);

allpage = ((RecordCount % PageSize) != 0 ? allpage + 1 : allpage);

allpage = (allpage == 0 ? 1 : allpage);
}

next = CurrentPage + 1;

pre = CurrentPage - 1;

if (PageNumberCount % 2 == 0)
{
startcount = (CurrentPage + PageNumberCount / 2) > allpage ? allpage - (PageNumberCount - 1) : CurrentPage - (PageNumberCount / 2 - 1);

endcount = CurrentPage < PageNumberCount / 2 ? PageNumberCount : CurrentPage + PageNumberCount / 2;

}
else
{
startcount = (CurrentPage + PageNumberCount / 2) > allpage ? allpage - (PageNumberCount - 1) : CurrentPage - (PageNumberCount / 2 - 1);

endcount = CurrentPage < PageNumberCount / 2 ? PageNumberCount : CurrentPage + PageNumberCount / 2 + 1;

}

if (startcount < 1) { startcount = 1; } //為了避免輸出的時候產生負數,設置如果小於1就從序號1開始

if (allpage < endcount) { endcount = allpage; }//頁碼+5的可能性就會產生最終輸出序號大於總頁碼,那麼就要將其控制在頁碼數之內

pagestr = "\n" + PageBeforeHtml + "\n";

pagestr += "<div class=\"pages-nav\">\n";

if (!AutoPageConcise)
{
pagestr += " <span class=\"default\">頁次:<strong>" + CurrentPage + "</strong>/<strong>" + allpage + "</strong> \n";

pagestr += "每頁<strong>" + PageSize.ToString() + "</strong>\n";

pagestr += " 記錄數<strong>" + RecordCount + "</strong>   \n </span>";
}

#region 上一頁標記

//pagestr += CurrentPage > 1 ? "<a href=\"" + Url + "&page=1\">1..</a> <a href=\"" + Url + "&page=" + pre + "\">" + LastPage + "</a>" : "<span class=\"disabled\">" + LastPage + "</span>";
pagestr += CurrentPage > 1 ? "<a href=\"javascript:" + JsFunctionName + "('" + this.ClientID.ToString() + "','1')\">1..</a> <a href=\"javascript:" + JsFunctionName + "('" + this.ClientID.ToString() + "','" + pre + "')\">" + LastPage + "</a>" : "<span class=\"disabled\">" + LastPage + "</span>";

#endregion

#region 中間頁處理,這個增加時間復雜度,減小空間復雜度

////中間頁處理,這個增加時間復雜度,減小空間復雜度
for (int i = startcount; i <= endcount; i++)
{
//pagestr += CurrentPage == i ? " <span class=\"current\">" + i + "</span>" : " <a href=\"" + Url + "&page=" + i + "\" >" + i + "</a>";
pagestr += CurrentPage == i ? " \n<span class=\"current\">" + i + "</span>" : " \n<a href=\"javascript:" + JsFunctionName + "('" + this.ClientID.ToString() + "','" + i + "')\">" + i + "</a>";
}

#endregion

#region 下一頁標記

//pagestr += CurrentPage != allpage ? " <a href=\"" + Url + "&page=" + next + "\">" + NextPage + "</a> <a href=\"" + Url + "&page=" + allpage + "\">.." + allpage + "</a>" : "<span class=\"disabled\">" + NextPage + "</span>";

pagestr += CurrentPage != allpage ? " <a href=\"javascript:" + JsFunctionName + "('" + this.ClientID.ToString() + "','" + next + "')\">" + NextPage + "</a> <a href=\"javascript:" + JsFunctionName + "('" + this.ClientID.ToString() + "','" + allpage + "')\">.." + allpage + "</a>" : "<span class=\"disabled\">" + NextPage + "</span>";

#endregion

if (SelectPage)
{
pagestr += " \n<input type=\"text\" title=\"輸入數字,回車跳轉\" size=\"3\" onkeydown=\"return PagegetUrls(this.value);\" value=\"" + CurrentPage + "\" class=\"PageCssInput\" style=\"cursor:hand\" />";

pagestr += "\n<script>\nfunction PagegetUrls(Values)\n{\n if (13==event.keyCode)\n {\n javascript:" + JsFunctionName + "('" + this.ClientID.ToString() + "',Values)\n return false;\n }\n}\n</script>\n";
}

pagestr += "\n</div>\n" + PageLastHtml + "\n";

return pagestr;
}

/// <summary>
/// 跳轉
/// </summary>
/// <param name="pagecount">總頁數</param>
/// <param name="currentpage">當前頁數</param>
/// <param name="Url">傳入鏈接地址</param>
/// <returns></returns>
private string SelectPages(int PageCount, int CurrentPage, string Url)
{
string ResultPage = "";

for (int k = 1; k <= PageCount; k++)
{
if (k == CurrentPage)
{
ResultPage += "<option value=\"" + Url + "&page=" + k + "\" selected>" + k + "</option>";
}
else
{
ResultPage += "<option value=\"" + Url + "&page=" + k + "\">" + k + "</option>";
}
}

return ResultPage;
}

/// <summary>
/// 判斷某一字符出現的次數
/// </summary>
/// <param name="str">目標字符串</param>
/// <param name="split">要查找的字符 只能為字符,不能為字符串,如果為字符串,則自動潔取第一個字符為默認的字符</param>
/// <returns></returns>
private string StringFindCount(string str, string split)
{
int c1 = 0;

string a = split;

if (split == null || split.ToString() == "" || split.ToString().Trim().Length < 1)
{
a = " ";
}
else if (split.ToString().Trim().Length > 1)
{
a = a.Substring(0, 1);
}
else
{

}
if (str == null || str.ToString().Trim().Replace("'", "") == "" || str.ToString().Trim().Replace("'", "").Length < 1)
{
c1 = 0;
}
else
{
for (int i = 0; i < str.Length; i++)
{
if (str[i] == char.Parse(a))
{
c1++;
}
}
}
return c1.ToString();
}
}

/// <summary>
/// 分頁樣式選擇器
/// </summary>
public class WebPageCssSelect : StringConverter
{
/// <summary>
/// 構造函數
/// </summary>
public WebPageCssSelect() { }

/// <summary>
/// 分頁樣式選擇器編輯屬性
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
{
return true;
}

/// <summary>
/// 獲取標准值列表
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public override System.ComponentModel.TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
{
ArrayList CssArray = new ArrayList();
CssArray.Add("Digg Style");
CssArray.Add("Yahoo Style");
CssArray.Add("New Yahoo! Style");
CssArray.Add("Meneame Style");
CssArray.Add("Flickr Style");
CssArray.Add("Sabros.us Style");
CssArray.Add("Green Style");
CssArray.Add("Gray Style");
CssArray.Add("Black Style");
CssArray.Add("Mis Algoritmos Style");
CssArray.Add("Black-Red Style");
CssArray.Add("Gray Style 2");
CssArray.Add("Yellow Style");
CssArray.Add("jogger Style");
CssArray.Add("512megas Style");
CssArray.Add("Technorati Style");
CssArray.Add("YouTube Style");
CssArray.Add("MSDN Search Style");
CssArray.Add("Msn Gray Style");
CssArray.Add("Badoo");
CssArray.Add("Blue Style");
CssArray.Add("Green-Black Style");
CssArray.Add("viciao Style");
CssArray.Add("默認樣式");
return new StandardValuesCollection(CssArray);

}

/// <summary>
/// return ture的話只能選,return flase可選可填
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
{
return false;
}
}

/// <summary>
/// 樣式對齊方式
/// </summary>
public class WebPageAlign : StringConverter
{
/// <summary>
/// 構造函數
/// </summary>
public WebPageAlign() { }

/// <summary>
/// 分頁樣式選擇器編輯屬性
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
{
return true;
}

/// <summary>
/// 獲取標准值列表
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public override System.ComponentModel.TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
{
ArrayList CssArray = new ArrayList();
CssArray.Add("right");
CssArray.Add("left");
CssArray.Add("center");
return new StandardValuesCollection(CssArray);

}

/// <summary>
/// return ture的話只能選,return flase可選可填
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
{
return false;
}
}

/// <summary>
/// 返回樣式內容
/// </summary>
public class WebPageCss
{
/// <summary>
/// 返回樣式中內容
/// </summary>
/// <param name="Css">樣式種類</param>
/// <param name="AlignSorts">樣式對齊方式</param>
/// <param name="BackGroundImageUrl">背景圖片</param>
/// <returns></returns>
public static string CssStyle(string Css, string AlignSorts,string BackGroundImageUrl)
{
string Result = "";

#region 輸出分頁鏈接樣式

Result+="\n<style type=\"text/css\">\n";

#region 分頁樣式控制

if (Css == "默認樣式" || Css == "")//默認分頁樣式
{
Result+="\n.pages-nav { PADDING-RIGHT: 2px; PADDING-LEFT: 2px; PADDING-BOTTOM: 1px; PADDING-TOP: 1px; TEXT-ALIGN: " + AlignSorts + ";clear:both;}";

Result+="\n.pages-nav a { PADDING-RIGHT: 2px; PADDING-LEFT: 2px; PADDING-BOTTOM: 1px;PADDING-TOP: 1px;}";

Result+="\n.pages-nav a:hover { PADDING-RIGHT: 2px; PADDING-LEFT: 2px;PADDING-BOTTOM: 1px; PADDING-TOP: 1px;background: #F30; border-color: #ddd; color: #fff; text-decoration: none;}";

Result+="\n.pages-nav a:active {PADDING-RIGHT: 2px; PADDING-LEFT: 2px; PADDING-BOTTOM: 1px;PADDING-TOP: 1px;}";

Result+="\n.pages-nav SPAN.current {PADDING-RIGHT: 2px; PADDING-LEFT: 2px; PADDING-BOTTOM: 1px; COLOR: #ff00ff; PADDING-TOP: 1px;}";

Result+="\n.pages-nav SPAN.default {PADDING-RIGHT: 2px; PADDING-LEFT: 2px; ; PADDING-BOTTOM: 1px; PADDING-TOP: 1px;}";

Result+="\n.pages-nav SPAN.disabled {PADDING-RIGHT:2px; PADDING-LEFT:2px; PADDING-BOTTOM:1px; COLOR: #ddd; PADDING-TOP: 1px;}";

Result+="\n.pages-nav input.PageCssInput {PADDING-RIGHT: 2px; PADDING-LEFT: 2px; ; PADDING-BOTTOM: 1px; PADDING-TOP: 1px;border:1px #cccccc solid}";
}
else if (Css == "Digg Style")
{
Result+="\n.pages-nav { PADDING-RIGHT: 3px; PADDING-LEFT: 3px; PADDING-BOTTOM: 3px; MARGIN: 3px; PADDING-TOP: 3px; TEXT-ALIGN: " + AlignSorts + ";clear:both;}";

Result+="\n.pages-nav a { BORDER-RIGHT: #aaaadd 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #aaaadd 1px solid; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; MARGIN: 2px; BORDER-LEFT: #aaaadd 1px solid; COLOR: #000099; PADDING-TOP: 2px; BORDER-BOTTOM: #aaaadd 1px solid; TEXT-DECORATION: none}";

Result+="\n.pages-nav a:hover { BORDER-RIGHT: #000099 1px solid; BORDER-TOP: #000099 1px solid; BORDER-LEFT: #000099 1px solid; COLOR: #000; BORDER-BOTTOM: #000099 1px solid}";

Result+="\n.pages-nav a:active { BORDER-RIGHT: #000099 1px solid; BORDER-TOP: #000099 1px solid; BORDER-LEFT: #000099 1px solid; COLOR: #000; BORDER-BOTTOM: #000099 1px solid }";

Result+="\n.pages-nav SPAN.current {BORDER-RIGHT: #000099 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #000099 1px solid; PADDING-LEFT: 5px; FONT-WEIGHT: bold; PADDING-BOTTOM: 2px; MARGIN: 2px; BORDER-LEFT: #000099 1px solid; COLOR: #fff; PADDING-TOP: 2px; BORDER-BOTTOM: #000099 1px solid; BACKGROUND-COLOR: #000099}";

Result+="\n.pages-nav SPAN.default {PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; MARGIN: 2px; COLOR: #000099; PADDING-TOP: 2px; TEXT-DECORATION: none}";

Result+="\n.pages-nav SPAN.disabled {BORDER-RIGHT: #eee 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #eee 1px solid; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; MARGIN: 2px; BORDER-LEFT: #eee 1px solid; COLOR: #ddd; PADDING-TOP: 2px; BORDER-BOTTOM: #eee 1px solid}";

Result+="\n.pages-nav input.PageCssInput {BORDER-RIGHT: #aaaadd 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #aaaadd 1px solid; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; MARGIN: 2px; BORDER-LEFT: #aaaadd 1px solid; COLOR: #000099; PADDING-TOP: 2px; BORDER-BOTTOM: #aaaadd 1px solid; TEXT-DECORATION: none}";
}
else if (Css == "Yahoo Style")
{
Result+="\n.pages-nav { PADDING-RIGHT: 3px; PADDING-LEFT: 3px; PADDING-BOTTOM: 3px; MARGIN: 3px; PADDING-TOP: 3px;TEXT-ALIGN: " + AlignSorts + ";clear:both;}";

Result+="\n.pages-nav a { BORDER-RIGHT: #fff 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #fff 1px solid; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; MARGIN: 2px; BORDER-LEFT: #fff 1px solid; COLOR: #000099; PADDING-TOP: 2px; BORDER-BOTTOM: #fff 1px solid; TEXT-DECORATION: underline}";

Result+="\n.pages-nav a:hover { BORDER-RIGHT: #000099 1px solid; BORDER-TOP: #000099 1px solid; BORDER-LEFT: #000099 1px solid; COLOR: #000; BORDER-BOTTOM: #000099 1px solid}";

Result+="\n.pages-nav a:active {BORDER-RIGHT: #000099 1px solid; BORDER-TOP: #000099 1px solid; BORDER-LEFT: #000099 1px solid; COLOR: #f00; BORDER-BOTTOM: #000099 1px solid }";

Result+="\n.pages-nav SPAN.current {BORDER-RIGHT: #fff 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #fff 1px solid; PADDING-LEFT: 5px; FONT-WEIGHT: bold; PADDING-BOTTOM: 2px; MARGIN: 2px; BORDER-LEFT: #fff 1px solid; COLOR: #000; PADDING-TOP: 2px; BORDER-BOTTOM: #fff 1px solid; BACKGROUND-COLOR: #fff}";

Result+="\n.pages-nav SPAN.default {PADDING-RIGHT: 5px;PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; MARGIN: 2px; COLOR: #000099; PADDING-TOP: 2px; TEXT-DECORATION: none}";

Result+="\n.pages-nav SPAN.disabled {BORDER-RIGHT: #eee 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #eee 1px solid; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; MARGIN: 2px; BORDER-LEFT: #eee 1px solid; COLOR: #ddd; PADDING-TOP: 2px; BORDER-BOTTOM: #eee 1px solid}";

Result+="\n.pages-nav input.PageCssInput {BORDER-RIGHT: #fff 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #fff 1px solid; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; MARGIN: 2px; BORDER-LEFT: #fff 1px solid; COLOR: #000099; PADDING-TOP: 2px; BORDER-BOTTOM: #fff 1px solid; TEXT-DECORATION: underline}";
}
else if (Css == "New Yahoo! Style")
{
Result+="\n.pages-nav { PADDING-RIGHT: 3px; PADDING-LEFT: 3px; PADDING-BOTTOM: 3px; MARGIN: 3px; PADDING-TOP: 3px; FONT-FAMILY: Tahoma,Helvetica,sans-serif; TEXT-ALIGN: " + AlignSorts + ";clear:both;}";

Result+="\n.pages-nav a { BORDER-RIGHT: #ccdbe4 1px solid; PADDING-RIGHT: 8px; BACKGROUND-POSITION: 50% bottom; BORDER-TOP: #ccdbe4 1px solid; PADDING-LEFT: 8px; PADDING-BOTTOM: 2px; BORDER-LEFT: #ccdbe4 1px solid; COLOR: #0061de; MARGIN-RIGHT: 3px; PADDING-TOP: 2px; BORDER-BOTTOM: #ccdbe4 1px solid; TEXT-DECORATION: none}";

Result+="\n.pages-nav a:hover { BORDER-RIGHT: #2b55af 1px solid; BORDER-TOP: #2b55af 1px solid; BACKGROUND-IMAGE: none; BORDER-LEFT: #2b55af 1px solid; COLOR: #fff; BORDER-BOTTOM: #2b55af 1px solid; BACKGROUND-COLOR: #3666d4}";

Result+="\n.pages-nav a:active {BORDER-RIGHT: #2b55af 1px solid; BORDER-TOP: #2b55af 1px solid; BACKGROUND-IMAGE: none; BORDER-LEFT: #2b55af 1px solid; COLOR: #fff; BORDER-BOTTOM: #2b55af 1px solid; BACKGROUND-COLOR: #3666d4 }";

Result+="\n.pages-nav SPAN.current {PADDING-RIGHT: 6px; PADDING-LEFT: 6px; FONT-WEIGHT: bold; PADDING-BOTTOM: 2px; COLOR: #000; MARGIN-RIGHT: 3px; PADDING-TOP: 2px}";

Result+="\n.pages-nav SPAN.default {PADDING-RIGHT: 8px; BACKGROUND-POSITION: 50% bottom; PADDING-LEFT: 8px; PADDING-BOTTOM: 2px;COLOR: #0061de; MARGIN-RIGHT: 3px; PADDING-TOP: 2px;TEXT-DECORATION: none}";

Result+="\n.pages-nav SPAN.disabled {DISPLAY: none}";

Result+="\n.pages-nav input.PageCssInput {BORDER-RIGHT: #ccdbe4 1px solid; PADDING-RIGHT: 8px; BACKGROUND-POSITION: 50% bottom; BORDER-TOP: #ccdbe4 1px solid; PADDING-LEFT: 8px; PADDING-BOTTOM: 2px; BORDER-LEFT: #ccdbe4 1px solid; COLOR: #0061de; MARGIN-RIGHT: 3px; PADDING-TOP: 2px; BORDER-BOTTOM: #ccdbe4 1px solid; TEXT-DECORATION: none}";
}
else if (Css == "Meneame Style")
{
Result+="\n.pages-nav {PADDING-RIGHT: 3px; PADDING-LEFT: 3px;PADDING-BOTTOM: 3px; MARGIN: 3px; COLOR: #ff6500; PADDING-TOP: 3px; TEXT-ALIGN: " + AlignSorts + " ;clear:both;}";

Result+="\n.pages-nav a {BORDER-RIGHT: #ff9600 1px solid; PADDING-RIGHT: 7px; BACKGROUND-POSITION: 50% bottom; BORDER-TOP: #ff9600 1px solid; PADDING-LEFT: 7px; BACKGROUND-IMAGE: url(meneame.jpg; PADDING-BOTTOM: 5px; BORDER-LEFT: #ff9600 1px solid; COLOR: #ff6500; MARGIN-RIGHT: 3px; PADDING-TOP: 5px; BORDER-BOTTOM: #ff9600 1px solid; TEXT-DECORATION: none }";

Result+="\n.pages-nav a:hover { BORDER-RIGHT: #ff9600 1px solid; BORDER-TOP: #ff9600 1px solid; BACKGROUND-IMAGE: none; BORDER-LEFT: #ff9600 1px solid; COLOR: #ff6500; BORDER-BOTTOM: #ff9600 1px solid; BACKGROUND-COLOR: #ffc794}";

Result+="\n.pages-nav a:active {BORDER-RIGHT: #ff9600 1px solid; BORDER-TOP: #ff9600 1px solid; BACKGROUND-IMAGE: none; BORDER-LEFT: #ff9600 1px solid; COLOR: #ff6500; BORDER-BOTTOM: #ff9600 1px solid; BACKGROUND-COLOR: #ffc794}";

Result+="\n.pages-nav SPAN.current {BORDER-RIGHT: #ff6500 1px solid; PADDING-RIGHT: 7px; BORDER-TOP: #ff6500 1px solid; PADDING-LEFT: 7px; FONT-WEIGHT: bold; PADDING-BOTTOM: 5px; BORDER-LEFT: #ff6500 1px solid; COLOR: #ff6500; MARGIN-RIGHT: 3px; PADDING-TOP: 5px; BORDER-BOTTOM: #ff6500 1px solid; BACKGROUND-COLOR: #ffbe94}";

Result+="\n.pages-nav SPAN.default {BORDER-RIGHT: #ff9600 1px solid; PADDING-RIGHT: 7px; BACKGROUND-POSITION: 50% bottom; BORDER-TOP: #ff9600 1px solid; PADDING-LEFT: 7px; BACKGROUND-IMAGE: url(meneame.jpg; PADDING-BOTTOM: 5px; BORDER-LEFT: #ff9600 1px solid; COLOR: #ff6500; MARGIN-RIGHT: 3px; PADDING-TOP: 5px; BORDER-BOTTOM: #ff9600 1px solid; TEXT-DECORATION: none}";

Result+="\n.pages-nav SPAN.disabled {BORDER-RIGHT: #ffe3c6 1px solid; PADDING-RIGHT: 7px; BORDER-TOP: #ffe3c6 1px solid; PADDING-LEFT: 7px; PADDING-BOTTOM: 5px; BORDER-LEFT: #ffe3c6 1px solid; COLOR: #ffe3c6; MARGIN-RIGHT: 3px; PADDING-TOP: 5px; BORDER-BOTTOM: #ffe3c6 1px solid}";
Result+="\n.pages-nav input.PageCssInput {BORDER-RIGHT: #ff9600 1px solid; PADDING-RIGHT: 7px; BACKGROUND-POSITION: 50% bottom; BORDER-TOP: #ff9600 1px solid; PADDING-LEFT: 7px; BACKGROUND-IMAGE: url(meneame.jpg; PADDING-BOTTOM: 5px; BORDER-LEFT: #ff9600 1px solid; COLOR: #ff6500; MARGIN-RIGHT: 3px; PADDING-TOP: 5px; BORDER-BOTTOM: #ff9600 1px solid; TEXT-DECORATION: none }";
}
else if (Css == "Flickr Style")
{
Result+="\n.pages-nav {PADDING-RIGHT: 3px; PADDING-LEFT: 3px; PADDING-BOTTOM: 3px; MARGIN: 3px; PADDING-TOP: 3px; TEXT-ALIGN: " + AlignSorts + " ;clear:both;}";

Result+="\n.pages-nav a { BORDER-RIGHT: #dedfde 1px solid; PADDING-RIGHT: 6px; BACKGROUND-POSITION: 50% bottom; BORDER-TOP: #dedfde 1px solid; PADDING-LEFT: 6px; PADDING-BOTTOM: 2px; BORDER-LEFT: #dedfde 1px solid; COLOR: #0061de; MARGIN-RIGHT: 3px; PADDING-TOP: 2px; BORDER-BOTTOM: #dedfde 1px solid; TEXT-DECORATION: none}";

Result+="\n.pages-nav a:hover { BORDER-RIGHT: #000 1px solid; BORDER-TOP: #000 1px solid; BACKGROUND-IMAGE: none; BORDER-LEFT: #000 1px solid; COLOR: #fff; BORDER-BOTTOM: #000 1px solid; BACKGROUND-COLOR: #0061de}";

Result+="\n.pages-nav a:active {BORDER-RIGHT: #000 1px solid; BORDER-TOP: #000 1px solid; BACKGROUND-IMAGE: none; BORDER-LEFT: #000 1px solid; COLOR: #fff; BORDER-BOTTOM: #000 1px solid; BACKGROUND-COLOR: #0061de}";

Result+="\n.pages-nav SPAN.current {PADDING-RIGHT: 6px; PADDING-LEFT: 6px; FONT-WEIGHT: bold; PADDING-BOTTOM: 2px; COLOR: #ff0084; MARGIN-RIGHT: 3px; PADDING-TOP: 2px}";

Result+="\n.pages-nav SPAN.default {PADDING-RIGHT: 6px; BACKGROUND-POSITION: 50% bottom;PADDING-LEFT: 6px; PADDING-BOTTOM: 2px; COLOR: #0061de; MARGIN-RIGHT: 3px; PADDING-TOP: 2px; TEXT-DECORATION: none}";

Result+="\n.pages-nav SPAN.disabled {PADDING-RIGHT: 6px; PADDING-LEFT: 6px; PADDING-BOTTOM: 2px; COLOR: #adaaad; MARGIN-RIGHT: 3px; PADDING-TOP: 2px}";

Result+="\n.pages-nav input.PageCssInput {BORDER-RIGHT: #dedfde 1px solid; PADDING-RIGHT: 6px; BACKGROUND-POSITION: 50% bottom; BORDER-TOP: #dedfde 1px solid; PADDING-LEFT: 6px; PADDING-BOTTOM: 2px; BORDER-LEFT: #dedfde 1px solid; COLOR: #0061de; MARGIN-RIGHT: 3px; PADDING-TOP: 2px; BORDER-BOTTOM: #dedfde 1px solid; TEXT-DECORATION: none}";
}
else if (Css == "Sabros.us Style")
{
Result+="\n.pages-nav {PADDING-RIGHT: 3px; PADDING-LEFT: 3px; PADDING-BOTTOM: 3px; MARGIN: 3px; PADDING-TOP: 3px; TEXT-ALIGN: " + AlignSorts + ";clear:both; }";

Result+="\n.pages-nav a {BORDER-RIGHT: #9aafe5 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #9aafe5 1px solid; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; BORDER-LEFT: #9aafe5 1px solid; COLOR: #2e6ab1; MARGIN-RIGHT: 2px; PADDING-TOP: 2px; BORDER-BOTTOM: #9aafe5 1px solid; TEXT-DECORATION: none }";

Result+="\n.pages-nav a:hover { BORDER-RIGHT: #2b66a5 1px solid; BORDER-TOP: #2b66a5 1px solid; BORDER-LEFT: #2b66a5 1px solid; COLOR: #000; BORDER-BOTTOM: #2b66a5 1px solid; BACKGROUND-COLOR: lightyellow}";

Result+="\n.pages-nav a:active {BORDER-RIGHT: #2b66a5 1px solid; BORDER-TOP: #2b66a5 1px solid; BORDER-LEFT: #2b66a5 1px solid; COLOR: #000; BORDER-BOTTOM: #2b66a5 1px solid; BACKGROUND-COLOR: lightyellow}";

Result+="\n.pages-nav SPAN.current {BORDER-RIGHT: navy 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: navy 1px solid; PADDING-LEFT: 5px; FONT-WEIGHT: bold; PADDING-BOTTOM: 2px; BORDER-LEFT: navy 1px solid; COLOR: #fff; MARGIN-RIGHT: 2px; PADDING-TOP: 2px; BORDER-BOTTOM: navy 1px solid; BACKGROUND-COLOR: #2e6ab1}";

Result+="\n.pages-nav SPAN.default {BORDER-RIGHT: #9aafe5 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #9aafe5 1px solid; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; BORDER-LEFT: #9aafe5 1px solid; COLOR: #2e6ab1; MARGIN-RIGHT: 2px; PADDING-TOP: 2px; BORDER-BOTTOM: #9aafe5 1px solid; TEXT-DECORATION: none}";

Result+="\n.pages-nav SPAN.disabled {BORDER-RIGHT: #929292 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #929292 1px solid; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; BORDER-LEFT: #929292 1px solid; COLOR: #929292; MARGIN-RIGHT: 2px; PADDING-TOP: 2px; BORDER-BOTTOM: #929292 1px solid}";
Result+="\n.pages-nav input.PageCssInput {BORDER-RIGHT: #9aafe5 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #9aafe5 1px solid; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; BORDER-LEFT: #9aafe5 1px solid; COLOR: #2e6ab1; MARGIN-RIGHT: 2px; PADDING-TOP: 2px; BORDER-BOTTOM: #9aafe5 1px solid; TEXT-DECORATION: none}";
}
else if (Css == "Green Style")
{
Result+="\n.pages-nav {PADDING-RIGHT: 3px; PADDING-LEFT: 3px; PADDING-BOTTOM: 3px; MARGIN: 3px; PADDING-TOP: 3px; TEXT-ALIGN: " + AlignSorts + " ;clear:both;}";

Result+="\n.pages-nav a { BORDER-RIGHT: #ddd 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #ddd 1px solid; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; BORDER-LEFT: #ddd 1px solid; COLOR: #88af3f; MARGIN-RIGHT: 2px; PADDING-TOP: 2px; BORDER-BOTTOM: #ddd 1px solid; TEXT-DECORATION: none}";

Result+="\n.pages-nav a:hover {BORDER-RIGHT: #85bd1e 1px solid; BORDER-TOP: #85bd1e 1px solid; BORDER-LEFT: #85bd1e 1px solid; COLOR: #638425; BORDER-BOTTOM: #85bd1e 1px solid; BACKGROUND-COLOR: #f1ffd6 }";

Result+="\n.pages-nav a:active {BORDER-RIGHT: #85bd1e 1px solid; BORDER-TOP: #85bd1e 1px solid; BORDER-LEFT: #85bd1e 1px solid; COLOR: #638425; BORDER-BOTTOM: #85bd1e 1px solid; BACKGROUND-COLOR: #f1ffd6}";

Result+="\n.pages-nav SPAN.current {BORDER-RIGHT: #b2e05d 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #b2e05d 1px solid; PADDING-LEFT: 5px; FONT-WEIGHT: bold; PADDING-BOTTOM: 2px; BORDER-LEFT: #b2e05d 1px solid; COLOR: #fff; MARGIN-RIGHT: 2px; PADDING-TOP: 2px; BORDER-BOTTOM: #b2e05d 1px solid; BACKGROUND-COLOR: #b2e05d}";

Result+="\n.pages-nav SPAN.default {PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; COLOR: #88af3f; MARGIN-RIGHT: 2px; PADDING-TOP: 2px;TEXT-DECORATION: none}";

Result+="\n.pages-nav SPAN.disabled {BORDER-RIGHT: #f3f3f3 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #f3f3f3 1px solid; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; BORDER-LEFT: #f3f3f3 1px solid; COLOR: #ccc; MARGIN-RIGHT: 2px; PADDING-TOP: 2px; BORDER-BOTTOM: #f3f3f3 1px solid}";
Result+="\n.pages-nav input.PageCssInput {BORDER-RIGHT: #ddd 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #ddd 1px solid; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; BORDER-LEFT: #ddd 1px solid; COLOR: #88af3f; MARGIN-RIGHT: 2px; PADDING-TOP: 2px; BORDER-BOTTOM: #ddd 1px solid; TEXT-DECORATION: none}";
}
else if (Css == "Gray Style")
{
Result+="\n.pages-nav {PADDING-RIGHT: 3px; PADDING-LEFT: 3px; PADDING-BOTTOM: 3px; MARGIN: 3px; PADDING-TOP: 3px; TEXT-ALIGN: " + AlignSorts + " ;clear:both;}";

Result+="\n.pages-nav a {BORDER-RIGHT: #ddd 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #ddd 1px solid; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; BORDER-LEFT: #ddd 1px solid; COLOR: #aaa; MARGIN-RIGHT: 2px; PADDING-TOP: 2px; BORDER-BOTTOM: #ddd 1px solid; TEXT-DECORATION: none }";

Result+="\n.pages-nav a:hover {BORDER-RIGHT: #a0a0a0 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #a0a0a0 1px solid; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; BORDER-LEFT: #a0a0a0 1px solid; MARGIN-RIGHT: 2px; PADDING-TOP: 2px; BORDER-BOTTOM: #a0a0a0 1px solid }";

Result+="\n.pages-nav a:active {BORDER-RIGHT: #a0a0a0 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #a0a0a0 1px solid; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; BORDER-LEFT: #a0a0a0 1px solid; MARGIN-RIGHT: 2px; PADDING-TOP: 2px; BORDER-BOTTOM: #a0a0a0 1px solid}";

Result+="\n.pages-nav SPAN.current {BORDER-RIGHT: #e0e0e0 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #e0e0e0 1px solid; PADDING-LEFT: 5px; FONT-WEIGHT: bold; PADDING-BOTTOM: 2px; BORDER-LEFT: #e0e0e0 1px solid; COLOR: #aaa; MARGIN-RIGHT: 2px; PADDING-TOP: 2px; BORDER-BOTTOM: #e0e0e0 1px solid; BACKGROUND-COLOR: #f0f0f0}";

Result+="\n.pages-nav SPAN.default {BORDER-RIGHT: #ddd 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #ddd 1px solid; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; BORDER-LEFT: #ddd 1px solid; COLOR: #aaa; MARGIN-RIGHT: 2px; PADDING-TOP: 2px; BORDER-BOTTOM: #ddd 1px solid; TEXT-DECORATION: none}";

Result+="\n.pages-nav SPAN.disabled {BORDER-RIGHT: #f3f3f3 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #f3f3f3 1px solid; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; BORDER-LEFT: #f3f3f3 1px solid; COLOR: #ccc; MARGIN-RIGHT: 2px; PADDING-TOP: 2px; BORDER-BOTTOM: #f3f3f3 1px solid}";
Result+="\n.pages-nav input.PageCssInput {BORDER-RIGHT: #ddd 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #ddd 1px solid; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; BORDER-LEFT: #ddd 1px solid; COLOR: #aaa; MARGIN-RIGHT: 2px; PADDING-TOP: 2px; BORDER-BOTTOM: #ddd 1px solid; TEXT-DECORATION: none }";
}
else if (Css == "Black Style")
{
Result+="\n.pages-nav { PADDING-RIGHT: 3px; PADDING-LEFT: 3px; PADDING-BOTTOM:6px; MARGIN:3px; COLOR: #a0a0a0; PADDING-TOP: 6px; BACKGROUND-COLOR: #000; TEXT-ALIGN: " + AlignSorts + ";clear:both;}";

Result+="\n.pages-nav a { BORDER-RIGHT: #909090 1px solid; PADDING-RIGHT: 5px; BACKGROUND-POSITION: 50% bottom; BORDER-TOP: #909090 1px solid; PADDING-LEFT: 5px; BACKGROUND-IMAGE: url(images/bar.gif; PADDING-BOTTOM: 2px; BORDER-LEFT: #909090 1px solid; COLOR: #c0c0c0; MARGIN-RIGHT: 3px; PADDING-TOP: 2px; BORDER-BOTTOM: #909090 1px solid; TEXT-DECORATION: none}";

Result+="\n.pages-nav a:hover {BORDER-RIGHT: #f0f0f0 1px solid; BORDER-TOP: #f0f0f0 1px solid; BACKGROUND-IMAGE: url(invbar.gif; BORDER-LEFT: #f0f0f0 1px solid; COLOR: #ffffff; BORDER-BOTTOM: #f0f0f0 1px solid; BACKGROUND-COLOR: #404040 }";

Result+="\n.pages-nav a:active {BORDER-RIGHT: #f0f0f0 1px solid; BORDER-TOP: #f0f0f0 1px solid; BACKGROUND-IMAGE: url(invbar.gif; BORDER-LEFT: #f0f0f0 1px solid; COLOR: #ffffff; BORDER-BOTTOM: #f0f0f0 1px solid; BACKGROUND-COLOR: #404040}";

Result+="\n.pages-nav SPAN.current {BORDER-RIGHT: #ffffff 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #ffffff 1px solid; PADDING-LEFT: 5px; FONT-WEIGHT: bold; PADDING-BOTTOM: 2px; BORDER-LEFT: #ffffff 1px solid; COLOR: #ffffff; MARGIN-RIGHT: 3px; PADDING-TOP: 2px; BORDER-BOTTOM: #ffffff 1px solid; BACKGROUND-COLOR: #606060}";

Result+="\n.pages-nav SPAN.default {BORDER-RIGHT: #909090 1px solid; PADDING-RIGHT: 5px; BACKGROUND-POSITION: 50% bottom; BORDER-TOP: #909090 1px solid; PADDING-LEFT: 5px; BACKGROUND-IMAGE: url(/images/bar.gif; PADDING-BOTTOM: 2px; BORDER-LEFT: #909090 1px solid; COLOR: #c0c0c0; MARGIN-RIGHT: 3px; PADDING-TOP: 2px; BORDER-BOTTOM: #909090 1px solid; TEXT-DECORATION: none}";

Result+="\n.pages-nav SPAN.disabled {BORDER-RIGHT: #606060 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #606060 1px solid; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; BORDER-LEFT: #606060 1px solid; COLOR: #808080; MARGIN-RIGHT: 3px; PADDING-TOP: 2px; BORDER-BOTTOM: #606060 1px solid}";
Result+="\n.pages-nav input.PageCssInput {BORDER-RIGHT: #909090 1px solid; PADDING-RIGHT: 5px; BACKGROUND-POSITION: 50% bottom; BORDER-TOP: #909090 1px solid; PADDING-LEFT: 5px; BACKGROUND-IMAGE: url(images/bar.gif; PADDING-BOTTOM: 2px; BORDER-LEFT: #909090 1px solid; COLOR: #c0c0c0; MARGIN-RIGHT: 3px; PADDING-TOP: 2px; BORDER-BOTTOM: #909090 1px solid; TEXT-DECORATION: none}";
}
else if (Css == "Mis Algoritmos Style")
{
Result+="\n.pages-nav { PADDING-RIGHT: 7px; PADDING-LEFT: 7px; PADDING-BOTTOM: 3px; MARGIN: 3px; PADDING-TOP: 3px; TEXT-ALIGN: " + AlignSorts + ";clear:both;}";

Result+="\n.pages-nav a {BORDER-RIGHT: #000000 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #000000 1px solid; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; MARGIN: 2px; BORDER-LEFT: #000000 1px solid; COLOR: #000000; PADDING-TOP: 2px; BORDER-BOTTOM: #000000 1px solid; TEXT-DECORATION: none }";

Result+="\n.pages-nav a:hover {BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-LEFT: #000000 1px solid; COLOR: #fff; BORDER-BOTTOM: #000000 1px solid; BACKGROUND-COLOR: #000 }";

Result+="\n.pages-nav a:active {BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-LEFT: #000000 1px solid; COLOR: #fff; BORDER-BOTTOM: #000000 1px solid; BACKGROUND-COLOR: #000}";

Result+="\n.pages-nav SPAN.current {BORDER-RIGHT: #000000 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #000000 1px solid; PADDING-LEFT: 5px; FONT-WEIGHT: bold; PADDING-BOTTOM: 2px; MARGIN: 2px; BORDER-LEFT: #000000 1px solid; COLOR: #fff; PADDING-TOP: 2px; BORDER-BOTTOM: #000000 1px solid; BACKGROUND-COLOR: #000000}";

Result+="\n.pages-nav SPAN.default {PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; MARGIN: 2px; COLOR: #000000; PADDING-TOP: 2px; TEXT-DECORATION: none}";

Result+="\n.pages-nav SPAN.disabled {BORDER-RIGHT: #eee 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #eee 1px solid; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; MARGIN: 2px; BORDER-LEFT: #eee 1px solid; COLOR: #ddd; PADDING-TOP: 2px; BORDER-BOTTOM: #eee 1px solid}";

Result+="\n.pages-nav input.PageCssInput {BORDER-RIGHT: #000000 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #000000 1px solid; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; MARGIN: 2px; BORDER-LEFT: #000000 1px solid; COLOR: #000000; PADDING-TOP: 2px; BORDER-BOTTOM: #000000 1px solid; TEXT-DECORATION: none}";
}
else if (Css == "Black-Red Style")
{
Result+="\n.pages-nav {padding-top:8px;padding-bottom:8px;background-color:#313131;FONT-SIZE: 12px; COLOR: #fff; FONT-FAMILY: Tahoma, Arial, Helvetica, Sans-serif; BACKGROUND-COLOR: #3e3e3e;text-align:" + AlignSorts + ";clear:both; }";

Result+="\n.pages-nav a { PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 3px; MARGIN: 2px; COLOR: #fff; PADDING-TOP: 3px; BACKGROUND-COLOR: #3e3e3e; TEXT-DECORATION: none}";

Result+="\n.pages-nav a:hover {COLOR: #fff; BACKGROUND-COLOR: #ec5210 }";

Result+="\n.pages-nav a:active {COLOR: #fff; BACKGROUND-COLOR: #ec5210;}";

Result+="\n.pages-nav SPAN.current {PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 3px; MARGIN: 2px; COLOR: #fff; PADDING-TOP: 3px; BACKGROUND-COLOR: #313131; TEXT-DECORATION: none;COLOR: #fff; }";

Result+="\n.pages-nav SPAN.default {PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; MARGIN: 2px; COLOR: #fff; PADDING-TOP: 2px; BACKGROUND-COLOR: #3e3e3e; TEXT-DECORATION: none}";

Result+="\n.pages-nav SPAN.disabled {PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; MARGIN: 2px; COLOR: #868686; PADDING-TOP: 2px; BACKGROUND-COLOR: #3e3e3e}";

Result+="\n.pages-nav input.PageCssInput {PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 3px; MARGIN: 2px; COLOR: #fff; PADDING-TOP: 3px; BACKGROUND-COLOR: #3e3e3e; TEXT-DECORATION: none}";
}
else if (Css == "Gray Style 2")
{
Result+="\n.pages-nav { PADDING-RIGHT: 2px; PADDING-LEFT: 2px; FONT-SIZE: 12px; PADDING-BOTTOM: 2px; PADDING-TOP: 2px; FONT-FAMILY: Tahoma, Arial, Helvetica, Sans-serif; BACKGROUND-COLOR: #c1c1c1;text-align:" + AlignSorts + ";clear:both;}";

Result+="\n.pages-nav a { PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; MARGIN: 2px; COLOR: #000; PADDING-TOP: 2px; BACKGROUND-COLOR: #c1c1c1; TEXT-DECORATION: none}";

Result+="\n.pages-nav a:hover { COLOR: #000; BACKGROUND-COLOR: #99ffff}";

Result+="\n.pages-nav a:active {COLOR: #000; BACKGROUND-COLOR: #99ffff}";

Result+="\n.pages-nav SPAN.current {PADDING-RIGHT: 5px; PADDING-LEFT: 5px; FONT-WEIGHT: bold; PADDING-BOTTOM: 2px; MARGIN: 2px; COLOR: #303030; PADDING-TOP: 2px; BACKGROUND-COLOR: #fff}";

Result+="\n.pages-nav SPAN.default {PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; MARGIN: 2px; COLOR: #000; PADDING-TOP: 2px; BACKGROUND-COLOR: #c1c1c1; TEXT-DECORATION: none}";

Result+="\n.pages-nav SPAN.disabled {PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; MARGIN: 2px; COLOR: #797979; PADDING-TOP: 2px; BACKGROUND-COLOR: #c1c1c1}";

Result+="\n.pages-nav input.PageCssInput {PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; MARGIN: 2px; COLOR: #000; PADDING-TOP: 2px; BACKGROUND-COLOR: #c1c1c1; TEXT-DECORATION: none}";
}
else if (Css == "Yellow Style")
{
Result+="\n.pages-nav { PADDING-RIGHT: 7px; PADDING-LEFT: 7px; PADDING-BOTTOM: 2px; MARGIN: 3px; PADDING-TOP:2px; TEXT-ALIGN: " + AlignSorts + ";clear:both;}";

Result+="\n.pages-nav a { BORDER-RIGHT: #ccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #ccc 1px solid; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; MARGIN: 2px; BORDER-LEFT: #ccc 1px solid; COLOR: #000; PADDING-TOP: 2px; BORDER-BOTTOM: #ccc 1px solid; TEXT-DECORATION: none}";

Result+="\n.pages-nav a:hover { BORDER-RIGHT: #f0f0f0 1px solid; BORDER-TOP: #f0f0f0 1px solid; BORDER-LEFT: #f0f0f0 1px solid; COLOR: #000; BORDER-BOTTOM: #f0f0f0 1px solid}";

Result+="\n.pages-nav a:active {BORDER-RIGHT: #f0f0f0 1px solid; BORDER-TOP: #f0f0f0 1px solid; BORDER-LEFT: #f0f0f0 1px solid; COLOR: #000; BORDER-BOTTOM: #f0f0f0 1px solid}";

Result+="\n.pages-nav SPAN.current {BORDER-RIGHT: #d9d300 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #d9d300 1px solid; PADDING-LEFT: 5px; FONT-WEIGHT: bold; PADDING-BOTTOM: 2px; MARGIN: 2px; BORDER-LEFT: #d9d300 1px solid; COLOR: #fff; PADDING-TOP: 2px; BORDER-BOTTOM: #d9d300 1px solid; BACKGROUND-COLOR: #d9d300}";

Result+="\n.pages-nav SPAN.default { PADDING-RIGHT: 5px;PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; MARGIN: 2px; COLOR: #000; PADDING-TOP: 2px; TEXT-DECORATION: none}";

Result+="\n.pages-nav SPAN.disabled {BORDER-RIGHT: #eee 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #eee 1px solid; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; MARGIN: 2px; BORDER-LEFT: #eee 1px solid; COLOR: #ddd; PADDING-TOP: 2px; BORDER-BOTTOM: #eee 1px solid}";

Result+="\n.pages-nav input.PageCssInput {BORDER-RIGHT: #ccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #ccc 1px solid; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; MARGIN: 2px; BORDER-LEFT: #ccc 1px solid; COLOR: #000; PADDING-TOP: 2px; BORDER-BOTTOM: #ccc 1px solid; TEXT-DECORATION: none}";
}
else if (Css == "jogger Style")
{
Result+="\n.pages-nav { PADDING-RIGHT: 4px; PADDING-LEFT: 4px; PADDING-BOTTOM: 2px; MARGIN: 7px; PADDING-TOP: 2px; FONT-FAMILY: \"Lucida Sans Unicode\", \"Lucida Grande\", LucidaGrande, \"Lucida Sans\", Geneva, Verdana, sans-serif;text-align:" + AlignSorts + ";clear:both;}";

Result+="\n.pages-nav a {PADDING-RIGHT: 4px; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; MARGIN: 2px; COLOR: #fff; PADDING-TOP: 2px; BACKGROUND-COLOR: #ee4e4e; TEXT-DECORATION: none }";

Result+="\n.pages-nav a:hover {PADDING-RIGHT: 4px; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; MARGIN: 2px; COLOR: #fff; PADDING-TOP: 2px; BACKGROUND-COLOR: #de1818 }";

Result+="\n.pages-nav a:active {PADDING-RIGHT: 4px; PADDING-LEFT: 5x; PADDING-BOTTOM: 2px; MARGIN: 2px; COLOR: #fff; PADDING-TOP: 2px; BACKGROUND-COLOR: #de1818}";

Result+="\n.pages-nav SPAN.current {PADDING-RIGHT: 4px; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; MARGIN: 2px; COLOR: #6d643c; PADDING-TOP: 2px; BACKGROUND-COLOR: #f6efcc}";

Result+="\n.pages-nav SPAN.default {PADDING-RIGHT: 4px; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; MARGIN: 2px; COLOR: #fff; PADDING-TOP: 2px; BACKGROUND-COLOR: #ee4e4e; TEXT-DECORATION: none}";

Result+="\n.pages-nav SPAN.disabled {DISPLAY: none}";

Result+="\n.pages-nav input.PageCssInput {PADDING-RIGHT: 4px; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; MARGIN: 2px; COLOR: #fff; PADDING-TOP: 2px; BACKGROUND-COLOR: #ee4e4e; TEXT-DECORATION: none }";
}
else if (Css == "512megas Style")
{
Result+="\n.pages-nav { PADDING-RIGHT: 3px; PADDING-LEFT: 3px; PADDING-BOTTOM: 2px; MARGIN: 3px; PADDING-TOP: 2px; TEXT-ALIGN: " + AlignSorts + ";clear:both;}";

Result+="\n.pages-nav a { BORDER-RIGHT: #dedfde 1px solid; PADDING-RIGHT: 6px; BACKGROUND-POSITION: 50% bottom; BORDER-TOP: #dedfde 1px solid; PADDING-LEFT: 6px; PADDING-BOTTOM: 2px; BORDER-LEFT: #dedfde 1px solid; COLOR: #99210b; MARGIN-RIGHT: 3px; PADDING-TOP: 2px; BORDER-BOTTOM: #dedfde 1px solid; TEXT-DECORATION: none}";

Result+="\n.pages-nav a:hover { BORDER-RIGHT: #000 1px solid; BORDER-TOP: #000 1px solid; BACKGROUND-IMAGE: none; BORDER-LEFT: #000 1px solid; COLOR: #fff; BORDER-BOTTOM: #000 1px solid; BACKGROUND-COLOR: #777777}";

Result+="\n.pages-nav a:active {BORDER-RIGHT: #000 1px solid; BORDER-TOP: #000 1px solid; BACKGROUND-IMAGE: none; BORDER-LEFT: #000 1px solid; COLOR: #fff; BORDER-BOTTOM: #000 1px solid; BACKGROUND-COLOR: #777777}";

Result+="\n.pages-nav SPAN.current {PADDING-RIGHT: 6px; PADDING-LEFT: 6px; FONT-WEIGHT: bold; PADDING-BOTTOM: 2px; COLOR: #99210b; MARGIN-RIGHT: 3px; PADDING-TOP: 2px}";

Result+="\n.pages-nav SPAN.default {PADDING-RIGHT: 6px; BACKGROUND-POSITION: 50% bottom;PADDING-LEFT: 6px; PADDING-BOTTOM: 2px; COLOR: #99210b; MARGIN-RIGHT: 3px; PADDING-TOP: 2px;TEXT-DECORATION: none}";

Result+="\n.pages-nav SPAN.disabled {PADDING-RIGHT: 6px; PADDING-LEFT: 6px; PADDING-BOTTOM: 2px; COLOR: #adaaad; MARGIN-RIGHT: 3px; PADDING-TOP: 2px}";

Result+="\n.pages-nav input.PageCssInput { BORDER-RIGHT: #dedfde 1px solid; PADDING-RIGHT: 6px; BACKGROUND-POSITION: 50% bottom; BORDER-TOP: #dedfde 1px solid; PADDING-LEFT: 6px; PADDING-BOTTOM: 2px; BORDER-LEFT: #dedfde 1px solid; COLOR: #99210b; MARGIN-RIGHT: 3px; PADDING-TOP: 2px; BORDER-BOTTOM: #dedfde 1px solid; TEXT-DECORATION: none}";
}
else if (Css == "Technorati Style")
{
Result+="\n.pages-nav {PADDING-RIGHT: 3px; PADDING-LEFT: 3px; PADDING-BOTTOM: 2px; MARGIN: 3px; PADDING-TOP: 2px; TEXT-ALIGN: " + AlignSorts + ";clear:both; }";

Result+="\n.pages-nav a { BORDER-RIGHT: #ccc 1px solid; PADDING-RIGHT: 6px; BACKGROUND-POSITION: 50% bottom; BORDER-TOP: #ccc 1px solid; PADDING-LEFT: 6px; FONT-WEIGHT: bold; PADDING-BOTTOM: 2px; BORDER-LEFT: #ccc 1px solid; COLOR: rgb(66,97,222; MARGIN-RIGHT: 3px; PADDING-TOP: 2px; BORDER-BOTTOM: #ccc 1px solid; TEXT-DECORATION: none}";

Result+="\n.pages-nav a:hover { BACKGROUND-IMAGE: none; COLOR: #fff; BACKGROUND-COLOR: #4261df}";

Result+="\n.pages-nav a:active {BACKGROUND-IMAGE: none; COLOR: #fff; BACKGROUND-COLOR: #4261df}";

Result+="\n.pages-nav SPAN.current {PADDING-RIGHT: 6px; PADDING-LEFT: 6px; FONT-WEIGHT: bold; PADDING-BOTTOM: 2px; COLOR: #000; MARGIN-RIGHT: 3px; PADDING-TOP: 2px}";

Result+="\n.pages-nav SPAN.default {PADDING-RIGHT: 6px; BACKGROUND-POSITION: 50% bottom; PADDING-LEFT: 6px; FONT-WEIGHT: bold; PADDING-BOTTOM: 2px; COLOR: rgb(66,97,222; MARGIN-RIGHT: 3px; PADDING-TOP: 2px;TEXT-DECORATION: none}";

Result+="\n.pages-nav SPAN.disabled {DISPLAY: none}";

Result+="\n.pages-nav input.PageCssInput { BORDER-RIGHT: #ccc 1px solid; PADDING-RIGHT: 6px; BACKGROUND-POSITION: 50% bottom; BORDER-TOP: #ccc 1px solid; PADDING-LEFT: 6px; FONT-WEIGHT: bold; PADDING-BOTTOM: 2px; BORDER-LEFT: #ccc 1px solid; COLOR: rgb(66,97,222; MARGIN-RIGHT: 3px; PADDING-TOP: 2px; BORDER-BOTTOM: #ccc 1px solid; TEXT-DECORATION: none}";
}
else if (Css == "YouTube Style")
{
Result+="\n.pages-nav { PADDING-RIGHT: 6px; BORDER-TOP: #9c9a9c 1px dotted; PADDING-LEFT: 0px; FONT-SIZE: 13px; PADDING-BOTTOM: 2px; COLOR: #313031; PADDING-TOP: 2px; FONT-FAMILY: Arial, Helvetica, sans-serif; BACKGROUND-COLOR: #cecfce; TEXT-ALIGN: " + AlignSorts + ";clear:both;}";

Result+="\n.pages-nav a { PADDING-RIGHT: 3px; PADDING-LEFT: 3px; FONT-WEIGHT: bold; PADDING-BOTTOM: 1px; MARGIN: 0px 1px; COLOR: #0030ce; PADDING-TOP: 1px; TEXT-DECORATION: underline}";

Result+="\n.pages-nav a:hover { }";

Result+="\n.pages-nav a:active {}";

Result+="\n.pages-nav SPAN.current {PADDING-RIGHT: 2px; PADDING-LEFT: 2px; PADDING-BOTTOM: 1px; COLOR: #000; PADDING-TOP: 1px; BACKGROUND-COLOR: #fff}";

Result+="\n.pages-nav SPAN.default {PADDING-RIGHT: 3px; PADDING-LEFT: 3px; FONT-WEIGHT: bold; PADDING-BOTTOM: 1px; MARGIN: 0px 1px; COLOR: #0030ce; PADDING-TOP: 1px; TEXT-DECORATION: underline}";

Result+="\n.pages-nav SPAN.disabled {DISPLAY: none}";

Result+="\n.pages-nav input.PageCssInput {PADDING-RIGHT: 3px; PADDING-LEFT: 3px; FONT-WEIGHT: bold; PADDING-BOTTOM: 1px; MARGIN: 0px 1px; COLOR: #0030ce; PADDING-TOP: 1px; TEXT-DECORATION: underline}";
}
else if (Css == "MSDN Search Style")
{
Result+="\n.pages-nav {PADDING-RIGHT: 6px; PADDING-LEFT: 0px; FONT-SIZE: 13px; PADDING-BOTTOM: 2px; COLOR: #313031; PADDING-TOP: 2px; FONT-FAMILY: Verdana,Tahoma,Arial,Helvetica,Sans-Serif; BACKGROUND-COLOR: #fff; TEXT-ALIGN: " + AlignSorts + ";margin-bottom:2px;clear:both;}";

Result+="\n.pages-nav a { BORDER-RIGHT: #b7d8ee 1px solid; PADDING-RIGHT: 6px; BORDER-TOP: #b7d8ee 1px solid; PADDING-LEFT: 5px; PADDING-BOTTOM: 4px; MARGIN: 0px 3px; BORDER-LEFT: #b7d8ee 1px solid; COLOR: #0030ce; PADDING-TOP: 5px; BORDER-BOTTOM: #b7d8ee 1px solid; TEXT-DECORATION: none}";

Result+="\n.pages-nav a:hover {BORDER-RIGHT: #b7d8ee 1px solid; BORDER-TOP: #b7d8ee 1px solid; BORDER-LEFT: #b7d8ee 1px solid; COLOR: #0066a7; BORDER-BOTTOM: #b7d8ee 1px solid; BACKGROUND-COLOR: #d2eaf6 }";

Result+="\n.pages-nav a:active {BORDER-RIGHT: #b7d8ee 1px solid; BORDER-TOP: #b7d8ee 1px solid; BORDER-LEFT: #b7d8ee 1px solid; COLOR: #0066a7; BORDER-BOTTOM: #b7d8ee 1px solid; BACKGROUND-COLOR: #d2eaf6}";

Result+="\n.pages-nav SPAN.current {BORDER-RIGHT: #b7d8ee 1px solid; PADDING-RIGHT: 6px; BORDER-TOP: #b7d8ee 1px solid; PADDING-LEFT: 5px; FONT-WEIGHT: bold; PADDING-BOTTOM: 4px; MARGIN: 0px 3px; BORDER-LEFT: #b7d8ee 1px solid; COLOR: #444444; PADDING-TOP: 5px; BORDER-BOTTOM: #b7d8ee 1px solid; BACKGROUND-COLOR: #d2eaf6}";

Result+="\n.pages-nav SPAN.default {BORDER-RIGHT: #b7d8ee 1px solid; PADDING-RIGHT: 6px; BORDER-TOP: #b7d8ee 1px solid; PADDING-LEFT: 5px; PADDING-BOTTOM: 4px; MARGIN: 0px 3px; BORDER-LEFT: #b7d8ee 1px solid; COLOR: #0030ce; PADDING-TOP: 5px; BORDER-BOTTOM: #b7d8ee 1px solid; TEXT-DECORATION: none}";

Result+="\n.pages-nav input.PageCssInput {BORDER-RIGHT: #b7d8ee 1px solid; PADDING-RIGHT: 6px; BORDER-TOP: #b7d8ee 1px solid; PADDING-LEFT: 5px; PADDING-BOTTOM: 4px; MARGIN: 0px 3px; BORDER-LEFT: #b7d8ee 1px solid; COLOR: #0030ce; PADDING-TOP: 5px; BORDER-BOTTOM: #b7d8ee 1px solid; TEXT-DECORATION: none}";

Result+="\n.pages-nav SPAN.disabled {DISPLAY: none}";
}
else if (Css == "Msn Gray Style")
{
Result+="\n.pages-nav { color:#0071b5;padding: 2px 0;margin:2px auto; text-align:" + AlignSorts + "; background:#f8f8f8; font-size:12px!important;}";

Result += "\n.pages-nav a { border:1px solid #c8c8c8;background-image:url(" + BackGroundImageUrl + "); height:19px; line-height:19px; padding:2px 5px; margin:1px; font-family:arial,nsimsun;font-size:12px!important; white-space:nowrap}";

Result+="\n.pages-nav a:hover { color:#ff9900; text-decoration:none!important;}";

Result+="\n.pages-nav a:active {color:#ff9900; text-decoration:none!important;}";

Result += "\n.pages-nav SPAN.current {border:1px solid #c8c8c8;background-image:url(" + BackGroundImageUrl + "); height:19px; line-height:19px; padding:2px 5px; margin:1px; font-family:arial,nsimsun;font-size:12px!important; white-space:nowrap;color:#ff9900;}";

Result+="\n.pages-nav span.default {color:#000000; text-decoration:none!important;}";

Result += "\n.pages-nav span.disabled {border:1px solid #c8c8c8;background-image:url(" + BackGroundImageUrl + "); height:19px; line-height:19px; padding:2px 5px; margin:1px; font-family:arial,nsimsun;font-size:12px!important; white-space:nowrap;}";

Result += "\n.pages-nav input.PageCssInput {border:1px solid #c8c8c8;background-image:url(" + BackGroundImageUrl + "); height:16px; line-height:16px;}";
}
else if (Css == "Badoo")
{
Result+="\n.pages-nav {PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 12px; PADDING-BOTTOM: 2px; COLOR: #48b9ef; PADDING-TOP: 2px; FONT-FAMILY: Arial, Helvetica, sans-serif; BACKGROUND-COLOR: #fff; TEXT-ALIGN: " + AlignSorts + ";margin-bottom:2px;clear:both;}";

Result+="\n.pages-nav a { BORDER-RIGHT: #f0f0f0 2px solid; PADDING-RIGHT: 5px; BORDER-TOP: #f0f0f0 2px solid; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; MARGIN: 0px 2px; BORDER-LEFT: #f0f0f0 2px solid; COLOR: #48b9ef; PADDING-TOP: 2px; BORDER-BOTTOM: #f0f0f0 2px solid; TEXT-DECORATION: none}";

Result+="\n.pages-nav a:hover { BORDER-RIGHT: #ff5a00 2px solid; BORDER-TOP: #ff5a00 2px solid; BORDER-LEFT: #ff5a00 2px solid; COLOR: #ff5a00; BORDER-BOTTOM: #ff5a00 2px solid}";

Result+="\n.pages-nav a:active {BORDER-RIGHT: #ff5a00 2px solid; BORDER-TOP: #ff5a00 2px solid; BORDER-LEFT: #ff5a00 2px solid; COLOR: #ff5a00; BORDER-BOTTOM: #ff5a00 2px solid}";

Result+="\n.pages-nav SPAN.current {BORDER-RIGHT: #ff5a00 2px solid; PADDING-RIGHT: 5px; BORDER-TOP: #ff5a00 2px solid; PADDING-LEFT: 5px; FONT-WEIGHT: bold; PADDING-BOTTOM: 2px; BORDER-LEFT: #ff5a00 2px solid; COLOR: #fff; PADDING-TOP: 2px; BORDER-BOTTOM: #ff5a00 2px solid; BACKGROUND-COLOR: #ff6c16}";

Result+="\n.pages-nav SPAN.default {PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; MARGIN: 0px 2px; COLOR: #48b9ef; PADDING-TOP: 2px; TEXT-DECORATION: none}";

Result+="\n.pages-nav SPAN.disabled {DISPLAY: none}";

Result+="\n.pages-nav input.PageCssInput {BORDER-RIGHT: #f0f0f0 2px solid; PADDING-RIGHT: 5px; BORDER-TOP: #f0f0f0 2px solid; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; MARGIN: 0px 2px; BORDER-LEFT: #f0f0f0 2px solid; COLOR: #48b9ef; PADDING-TOP: 2px; BORDER-BOTTOM: #f0f0f0 2px solid; TEXT-DECORATION: none}";
}
else if (Css == "Blue Style")
{
Result+="\n.pages-nav {PADDING-RIGHT: 3px; PADDING-LEFT: 3px; PADDING-BOTTOM: 2px; MARGIN: 3px; PADDING-TOP: 2px; TEXT-ALIGN: " + AlignSorts + ";clear:both; }";

Result+="\n.pages-nav a { BORDER-RIGHT: #eee 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #eee 1px solid; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; MARGIN: 2px; BORDER-LEFT: #eee 1px solid; COLOR: #036cb4; PADDING-TOP: 2px; BORDER-BOTTOM: #eee 1px solid; TEXT-DECORATION: none}";

Result+="\n.pages-nav a:hover { BORDER-RIGHT: #999 1px solid; BORDER-TOP: #999 1px solid; BORDER-LEFT: #999 1px solid; COLOR: #666; BORDER-BOTTOM: #999 1px solid}";

Result+="\n.pages-nav a:active {BORDER-RIGHT: #999 1px solid; BORDER-TOP: #999 1px solid; BORDER-LEFT: #999 1px solid; COLOR: #666; BORDER-BOTTOM: #999 1px solid}";

Result+="\n.pages-nav SPAN.current {BORDER-RIGHT: #036cb4 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #036cb4 1px solid; PADDING-LEFT: 5px; FONT-WEIGHT: bold; PADDING-BOTTOM: 2px; MARGIN: 2px; BORDER-LEFT: #036cb4 1px solid; COLOR: #fff; PADDING-TOP: 2px; BORDER-BOTTOM: #036cb4 1px solid; BACKGROUND-COLOR: #036cb4}";

Result+="\n.pages-nav SPAN.default {PADDING-RIGHT: 5px;PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; MARGIN: 2px; COLOR: #036cb4; PADDING-TOP: 2px; TEXT-DECORATION: none}";

Result+="\n.pages-nav SPAN.disabled {BORDER-RIGHT: #eee 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #eee 1px solid; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; MARGIN: 2px; BORDER-LEFT: #eee 1px solid; COLOR: #ddd; PADDING-TOP: 2px; BORDER-BOTTOM: #eee 1px solid}";

Result+="\n.pages-nav input.PageCssInput {BORDER-RIGHT: #999 1px solid; BORDER-TOP: #999 1px solid; BORDER-LEFT: #999 1px solid; COLOR: #666; BORDER-BOTTOM: #999 1px solid}";
}
else if (Css == "Green-Black Style")
{
Result+="\n.pages-nav {PADDING-RIGHT: 3px; PADDING-LEFT: 3px; PADDING-BOTTOM: 2px; MARGIN: 3px; PADDING-TOP: 2px; TEXT-ALIGN: " + AlignSorts + " ;clear:both;}";

Result+="\n.pages-nav a {BORDER-RIGHT: #2c2c2c 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #2c2c2c 1px solid; PADDING-LEFT: 5px; BACKGROUND: url(/images/pageimage1.gif) #2c2c2c; PADDING-BOTTOM: 2px; BORDER-LEFT: #2c2c2c 1px solid; COLOR: #fff; MARGIN-RIGHT: 2px; PADDING-TOP: 2px; BORDER-BOTTOM: #2c2c2c 1px solid; TEXT-DECORATION: none }";

Result+="\n.pages-nav a:hover {BORDER-RIGHT: #aad83e 1px solid; BORDER-TOP: #aad83e 1px solid; BACKGROUND: url(images/pageimage2.gif) #aad83e; BORDER-LEFT: #aad83e 1px solid; COLOR: #fff; BORDER-BOTTOM: #aad83e 1px solid }";

Result+="\n.pages-nav a:active {BORDER-RIGHT: #aad83e 1px solid; BORDER-TOP: #aad83e 1px solid; BACKGROUND: url(images/pageimage2.gif) #aad83e; BORDER-LEFT: #aad83e 1px solid; COLOR: #fff; BORDER-BOTTOM: #aad83e 1px solid}";

Result+="\n.pages-nav SPAN.current {BORDER-RIGHT: #aad83e 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #aad83e 1px solid; PADDING-LEFT: 5px; FONT-WEIGHT: bold; BACKGROUND: url(/images/pageimage2.gif) #aad83e; PADDING-BOTTOM: 2px; BORDER-LEFT: #aad83e 1px solid; COLOR: #fff; MARGIN-RIGHT: 2px; PADDING-TOP: 2px; BORDER-BOTTOM: #aad83e 1px solid}";

Result+="\n.pages-nav SPAN.default {BORDER-RIGHT: #2c2c2c 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #2c2c2c 1px solid; PADDING-LEFT: 5px; BACKGROUND: url(/images/pageimage1.gif) #2c2c2c; PADDING-BOTTOM: 2px; BORDER-LEFT: #2c2c2c 1px solid; COLOR: #fff; MARGIN-RIGHT: 2px; PADDING-TOP: 2px; BORDER-BOTTOM: #2c2c2c 1px solid; TEXT-DECORATION: none}";

Result+="\n.pages-nav SPAN.disabled {BORDER-RIGHT: #f3f3f3 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #f3f3f3 1px solid; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; BORDER-LEFT: #f3f3f3 1px solid; COLOR: #ccc; MARGIN-RIGHT: 2px; PADDING-TOP: 2px; BORDER-BOTTOM: #f3f3f3 1px solid}";
Result+="\n.pages-nav input.PageCssInput {BORDER-RIGHT: #2c2c2c 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #2c2c2c 1px solid; PADDING-LEFT: 5px; BACKGROUND: url(/images/pageimage1.gif) #2c2c2c; PADDING-BOTTOM: 2px; BORDER-LEFT: #2c2c2c 1px solid; COLOR: #fff; MARGIN-RIGHT: 2px; PADDING-TOP: 2px; BORDER-BOTTOM: #2c2c2c 1px solid; TEXT-DECORATION: none }";
}
else if (Css == "viciao Style")
{
Result+="\n.pages-nav { MARGIN-TOP: 10px; MARGIN-BOTTOM: 10px;TEXT-ALIGN: " + AlignSorts + ";clear:both;}";

Result+="\n.pages-nav a { BORDER-RIGHT: #8db5d7 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #8db5d7 1px solid; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; BORDER-LEFT: #8db5d7 1px solid; COLOR: #000; MARGIN-RIGHT: 2px; PADDING-TOP: 2px; BORDER-BOTTOM: #8db5d7 1px solid; TEXT-DECORATION: none}";

Result+="\n.pages-nav a:hover { BORDER-RIGHT: red 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: red 1px solid; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; BORDER-LEFT: red 1px solid; MARGIN-RIGHT: 2px; PADDING-TOP: 2px; BORDER-BOTTOM: red 1px solid}";

Result+="\n.pages-nav a:active {BORDER-RIGHT: red 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: red 1px solid; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; BORDER-LEFT: red 1px solid; MARGIN-RIGHT: 2px; PADDING-TOP: 2px; BORDER-BOTTOM: red 1px solid}";

Result+="\n.pages-nav SPAN.current {BORDER-RIGHT: #e89954 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #e89954 1px solid; PADDING-LEFT: 5px; FONT-WEIGHT: bold; PADDING-BOTTOM: 2px; BORDER-LEFT: #e89954 1px solid; COLOR: #000; MARGIN-RIGHT: 2px; PADDING-TOP: 2px; BORDER-BOTTOM: #e89954 1px solid; BACKGROUND-COLOR: #ffca7d}";

Result+="\n.pages-nav SPAN.default {PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; COLOR: #000; MARGIN-RIGHT: 2px; PADDING-TOP: 2px;TEXT-DECORATION: none}";

Result+="\n.pages-nav SPAN.disabled {BORDER-RIGHT: #ccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #ccc 1px solid; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; BORDER-LEFT: #ccc 1px solid; COLOR: #ccc; MARGIN-RIGHT: 2px; PADDING-TOP: 2px; BORDER-BOTTOM: #ccc 1px solid}";

Result+="\n.pages-nav input.PageCssInput {BORDER-RIGHT: #8db5d7 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #8db5d7 1px solid; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; BORDER-LEFT: #8db5d7 1px solid; COLOR: #000; MARGIN-RIGHT: 2px; PADDING-TOP: 2px; BORDER-BOTTOM: #8db5d7 1px solid; TEXT-DECORATION: none}";
}
else//默認分頁樣式
{
Result+="\n.pages-nav { PADDING-RIGHT: 2px; PADDING-LEFT: 2px; PADDING-BOTTOM: 1px; PADDING-TOP: 1px; TEXT-ALIGN: " + AlignSorts + ";clear:both;}";

Result+="\n.pages-nav a { PADDING-RIGHT: 2px; PADDING-LEFT: 2px; PADDING-BOTTOM: 1px;PADDING-TOP: 1px;}";

Result+="\n.pages-nav a:hover { PADDING-RIGHT: 2px; PADDING-LEFT: 2px;PADDING-BOTTOM: 1px; PADDING-TOP: 1px;background: #F30; border-color: #ddd; color: #fff; text-decoration: none;}";

Result+="\n.pages-nav a:active {PADDING-RIGHT: 2px; PADDING-LEFT: 2px; PADDING-BOTTOM: 1px;PADDING-TOP: 1px;}";

Result+="\n.pages-nav SPAN.current {PADDING-RIGHT: 2px; PADDING-LEFT: 2px; PADDING-BOTTOM: 1px; COLOR: #ff00ff; PADDING-TOP: 1px;}";

Result+="\n.pages-nav SPAN.default {PADDING-RIGHT: 2px; PADDING-LEFT: 2px; ; PADDING-BOTTOM: 1px; PADDING-TOP: 1px;}";

Result+="\n.pages-nav SPAN.disabled {PADDING-RIGHT:2px; PADDING-LEFT:2px; PADDING-BOTTOM:1px; COLOR: #ddd; PADDING-TOP: 1px;}";

Result+="\n.pages-nav input.PageCssInput {PADDING-RIGHT: 2px; PADDING-LEFT: 2px; ; PADDING-BOTTOM: 1px; PADDING-TOP: 1px;border:1px #cccccc solid}";
}

#endregion

Result+="\n</style>";

#endregion

return Result;
}
}
}

基類Repeater.cs代碼如下:
復制代碼 代碼如下:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebControlLibrary
{
/// <summary>
/// Repeater 控件。
/// </summary>
[DefaultProperty("Text"), ToolboxData("<{0}:Repeater runat=server></{0}:Repeater>")]
public class Repeater : System.Web.UI.WebControls.Repeater
{
/// <summary>
/// 構造函數
/// </summary>
public Repeater()
: base()
{
}
}
}


所使用的存儲過程如下:
復制代碼 代碼如下:
------------------------------------
--用途:大容量數據存儲過程分頁
--時間:2009-07-18 22:12
--作者:輕舞飛揚
--qq號:42383239
------------------------------------
CREATE PROC PageView
@tbname sysname, --要分頁顯示的表名
@FieldKey nvarchar(1000), --用於定位記錄的主鍵(惟一鍵)字段,可以是逗號分隔的多個字段
@PageCurrent int=1, --要顯示的頁碼
@PageSize int=10, --每頁的大小(記錄數)
@FieldShow nvarchar(1000)='', --以逗號分隔的要顯示的字段列表,如果不指定,則顯示所有字段
@FieldOrder nvarchar(1000)='', --以逗號分隔的排序字段列表,可以指定在字段後面指定DESC/ASC用於指定排序順序
@Where nvarchar(1000)='' --查詢條件
--@PageCount int=null OUTPUT --總頁數
AS

SET NOCOUNT ON
declare @PageCount int
--檢查對象是否有效
IF OBJECT_ID(@tbname) IS NULL
BEGIN
RAISERROR(N'對象"%s"不存在',1,16,@tbname)
RETURN
END

IF OBJECTPROPERTY(OBJECT_ID(@tbname),N'IsTable')=0
AND OBJECTPROPERTY(OBJECT_ID(@tbname),N'IsView')=0
AND OBJECTPROPERTY(OBJECT_ID(@tbname),N'IsTableFunction')=0
BEGIN
RAISERROR(N'"%s"不是表、視圖或者表值函數',1,16,@tbname)
RETURN
END

--分頁字段檢查
IF ISNULL(@FieldKey,N'')=''
BEGIN
RAISERROR(N'分頁處理需要主鍵(或者惟一鍵)',1,16)
RETURN
END

--其他參數檢查及規范
IF ISNULL(@PageCurrent,0)<1 SET @PageCurrent=1
IF len(@PageCurrent)>5 SET @PageCurrent=1
IF ISNULL(@PageSize,0)<1 SET @PageSize=10
IF ISNULL(@FieldShow,N'')=N'' SET @FieldShow=N'*'

IF ISNULL(@FieldOrder,N'')=N''
SET @FieldOrder=N''
ELSE
SET @FieldOrder=N'ORDER BY '+LTRIM(@FieldOrder)

IF ISNULL(@Where,N'')=N''
SET @Where=N''
ELSE
SET @Where=N'WHERE ('+@Where+N')'



--如果@PageCount為NULL值,則計算總頁數(這樣設計可以只在第一次計算總頁數,以後調用時,把總頁數傳回給存儲過程,避免再次計算總頁數,對於不想計算總頁數的處理而言,可以給@PageCount賦值)
IF @PageCount IS NULL
BEGIN
DECLARE @sql nvarchar(4000)
SET @sql=N'SELECT @PageCount=COUNT(*)'
+N' FROM '+@tbname
+N' '+@Where
--EXEC sp_executesql @sql,N'@PageCount int OUTPUT',@PageCount OUTPUT
SET @PageCount=(@PageCount+@PageSize-1)/@PageSize
END

--計算分頁顯示的TOPN值
DECLARE @TopN varchar(20),@TopN1 varchar(20)
SELECT @TopN=@PageSize,
@TopN1=(@PageCurrent-1)*@PageSize

--第一頁直接顯示
IF @PageCurrent=1
EXEC(N'SELECT TOP '+@TopN
+N' '+@FieldShow
+N' FROM '+@tbname
+N' '+@Where
+N' '+@FieldOrder)
ELSE
BEGIN
--處理別名
IF @FieldShow=N'*'
SET @FieldShow=N'a.*'

--生成主鍵(惟一鍵)處理條件
DECLARE @Where1 nvarchar(4000),@Where2 nvarchar(4000),
@s nvarchar(1000),@Field sysname
SELECT @Where1=N'',@Where2=N'',@s=@FieldKey
WHILE CHARINDEX(N',',@s)>0

if len(@s)>2-----解決當主鍵字段長度小於2時出現的情況
begin
SELECT @Field=LEFT(@s,CHARINDEX(N',',@s)-1),
@s=STUFF(@s,1,CHARINDEX(N',',@s),N''),
@Where1=@Where1+N' AND a.'+@Field+N'=b.'+@Field,
@Where2=@Where2+N' AND b.'+@Field+N' IS NULL',
@Where=REPLACE(@Where,@Field,N'a.'+@Field),
@FieldOrder=REPLACE(@FieldOrder,@Field,N'a.'+@Field),
@FieldShow=REPLACE(@FieldShow,@Field,N'a.'+@Field)
end
else
begin
SELECT @Field=@s,
@s=STUFF(@s,1,CHARINDEX(N',',@s),N''),
@Where1=@Where1+N' AND a.'+@Field+N'=b.'+@Field,
@Where2=@Where2+N' AND b.'+@Field+N' IS NULL',
@Where=REPLACE(@Where,@Field,N'a.'+@Field),
@FieldOrder=REPLACE(@FieldOrder,@Field,N'a.'+@Field),
@FieldShow=REPLACE(@FieldShow,@Field,N'a.'+@Field)
end


SELECT @Where=REPLACE(@Where,@s,N'a.'+@s),
@FieldOrder=REPLACE(@FieldOrder,@s,N'a.'+@s),
@FieldShow=REPLACE(@FieldShow,@s,N'a.'+@s),
@Where1=STUFF(@Where1+N' AND a.'+@s+N'=b.'+@s,1,5,N''),
@Where2=CASE
WHEN @Where='' THEN N'WHERE ('
ELSE @Where+N' AND ('
END+N'b.'+@s+N' IS NULL'+@Where2+N')'

--執行查詢
EXEC(N'SELECT TOP '+@TopN
+N' '+@FieldShow
+N' FROM '+@tbname
+N' a LEFT JOIN(SELECT TOP '+@TopN1
+N' '+@FieldKey
+N' FROM '+@tbname
+N' a '+@Where
+N' '+@FieldOrder
+N')b ON '+@Where1
+N' '+@Where2
+N' '+@FieldOrder)
END

GO


調用的數據庫底層代碼:
復制代碼 代碼如下:
using System;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Collections;
using System.Collections.Generic;
using System.Xml;
using System.Text;
using System.Data.Common;
using System.Text.RegularExpressions;
using System.Reflection;
using System.IO;

namespace Sql_Function
{
/// <summary>
/// 數據處理底層 數據基本操作
/// </summary>
public class SqlDb
{
#region 數據庫公用連接字符串

public static readonly string ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ToString();

#endregion

#region 數據庫操作方法 連接和關閉對象

/// <summary>
/// 打開數據庫連接
/// </summary>
/// <returns></returns>
public static SqlConnection OpenDataBase()
{
SqlConnection conn = new SqlConnection(ConnectionString);

try
{
conn.Open();

return conn;
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}

/// <summary>
/// 關閉數據庫連接
/// </summary>
/// <param name="conn"></param>
public static void CloseDataBase(SqlConnection conn)
{
try
{
if (conn != null)
{
conn.Close();

conn.Dispose();
}
}
catch (Exception ex)
{
conn.Close();

conn.Dispose();

throw new Exception(ex.Message);
//throw new ArgumentNullException("connection");
}
finally
{
conn.Close();
}
}

#endregion

#region 數據庫返回DataTable

/// <summary>
/// 返回指定Sql語句的返回DataTable
/// </summary>
/// <param name="strSQL">傳入的Sql語句</param>
/// <returns>DataTable</returns>
public static DataTable ReturnDataTable(string strSQL)
{
SqlConnection conn = OpenDataBase();

DataTable table = new DataTable();

SqlDataAdapter da = null;

try
{
da = new SqlDataAdapter(strSQL, conn);

da.Fill(table);

da.Dispose();

CloseDataBase(conn);

return table;
}
catch (Exception e)
{
da.Dispose();

table.Dispose();

CloseDataBase(conn);

throw new Exception(e.Message);
}
finally
{
da.Dispose();

CloseDataBase(conn);
}
}

/// <summary>
/// 返回DataTable記錄集,並且實現分頁功能
/// </summary>
/// <param name="sqls">傳入SQL語句</param>
/// <param name="currentpage">當前頁</param>
/// <param name="pagesize">每頁分頁大小</param>
/// <param name="table">填充數據庫表名稱</param>
/// <returns></returns>
public static DataTable ReturnDataTablePage(string sqls, int currentpage, int pagesize, string table)
{
SqlConnection conn = OpenDataBase();

DataSet ds = new DataSet();

SqlDataAdapter da = new SqlDataAdapter(sqls, conn);

try
{
int startcount;

if (currentpage < 1)
{
startcount = currentpage * pagesize;
}
else
{
startcount = (currentpage - 1) * pagesize;
}

da.Fill(ds, startcount, pagesize, table);

da.Dispose();

CloseDataBase(conn);

return ds.Tables[0];
}
catch (Exception ex)
{
da.Dispose();

CloseDataBase(conn);

ds.Dispose();

throw new Exception(ex.Message);
}
finally
{
da.Dispose();

CloseDataBase(conn);
}
}

#endregion

#region 數據庫公用方法集

/// <summary>
/// 返回記錄總數 傳入帶有count(主鍵)統計的Sql語句
/// </summary>
/// <param name="StrSql">傳入帶有count(主鍵)統計的Sql語句</param>
/// <returns></returns>
public static string RecordCounts(string StrSql)
{
string ProcInfo = "0";

SqlConnection conn = OpenDataBase();

SqlCommand comm = new SqlCommand(StrSql, conn);

comm.CommandTimeout = 120;

SqlDataReader DataReaders = comm.ExecuteReader(); //返回值

if (DataReaders.Read())
{
ProcInfo = DataReaders[0].ToString();
}

DataReaders.Close();

comm.Dispose();

CloseDataBase(conn);

return ProcInfo;
}

#endregion
}
}

using System;
using System.Collections.Generic;
using System.Text;

namespace Sql_Function
{
public class PublicFunction
{
/// <summary>
/// 判斷是否為數字 TRUE代表不是數字,False代表是數字
/// </summary>
/// <param name="s">字符串</param>
/// <returns></returns>
public static bool isNumber(string s)
{
int Flag = 0;
char[] str = s.ToCharArray();
for (int i = 0; i < str.Length; i++)
{
if (Char.IsNumber(str[i]))
{
Flag++;
}
else
{
Flag = -1;
break;
}
}
if (Flag > 0)
{
return false;
}
else
{
return true;
}
}

}
}


前台頁面樣例:
復制代碼 代碼如下:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Index.aspx.cs" Inherits="FrameWork.Web.Index" %>

<!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">
<title>Repeater數據分頁</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<style type="text/css">
<!--
body,td,th {
font-size: 12px;
}
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
a {
font-size: 12px;
color: #000000;
}
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #000000;
}
a:hover {
text-decoration: underline;
color: #4455aa;
}
a:active {
text-decoration: none;
color: #000000;
}
-->
</style>
</head>
<body>
<br>
<br>
<br>
<WebControl:RepeaterPages ID="RepeaterPages1" runat="server" AutoPageConcise="True" Css="Msn Gray Style" PageSize="15" SelectPage="False">
<HeaderTemplate>
<div style="line-height:200%;width:700px;margin:0 auto;">
<ul>
</HeaderTemplate>
<ItemTemplate>
<li style="list-style:none;">·<a href="javascript:"><%#Eval("Sys_NewsList_Title")%></a></li>
</ItemTemplate>
<FooterTemplate>
</ul>
</div>
</FooterTemplate>
</WebControl:RepeaterPages>
</body>
</html>

後台代碼:
復制代碼 代碼如下:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace FrameWork.Web
{
public partial class Index : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Bind();
}
}

protected void Bind()
{
string Sql = "select count(Sys_NewsList_ID) from Sys_NewsList";//查詢Sql語句

#region 列表選項

#region 分頁控件基本屬性

RepeaterPages1.SqlString = Sql;//用於統計總記錄數和進行數據分頁的Sql語句

RepeaterPages1.LastPage = "< Prev";

RepeaterPages1.NextPage = "Next > ";

RepeaterPages1.PageBeforeHtml = "";

RepeaterPages1.PageLastHtml = "";

#region 構造Url參數

System.Text.StringBuilder StrBulider = new System.Text.StringBuilder();

StrBulider.Append("&a=");

#endregion

RepeaterPages1.Url = StrBulider.ToString();

#endregion

#region 數據綁定

RepeaterPages1.DataSource = RepeaterPages1.getObjectRecordCount(true, "PageView", "Sys_NewsList", "Sys_NewsList_ID", " Sys_NewsList_ID desc", " Sys_NewsList_ID is not null");

RepeaterPages1.DataBind();

#endregion

#endregion
}
}
}


  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved