asp.net Repeater之非常好的数据分页

分页控件源代码如下:


代码如下:

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
}
}
}

(0)

相关推荐

  • asp.net下Repeater使用 AspNetPager分页控件

    一.AspNetPager分页控件 分页是Web应用程序中最常用到的功能之一,在ASP.NET中,虽然自带了一个可以分页的DataGrid(asp.net 1.1)和GridView(asp.net 2.0)控件,但其分页功能并不尽如人意,如可定制性差.无法通过Url实现分页功能等,而且有时候我们需要对DataList和Repeater甚至自定义数据绑定控件进行分页,手工编写分页代码不但技术难度大.任务繁琐而且代码重用率极低,因此分页已成为许多ASP.NET程序员最头疼的问题之一. AspNet

  • asp.net Repeater分页实例(PageDataSource的使用)

    Asp.net提供了三个功能强大的列表控件:DataGrid.DataList和Repeater控件,但其中只有DataGrid控件提供分页功能.相对DataGrid,DataList和Repeater控件具有更高的样式自定义性,所以很多时候我们喜欢使用DataList或Repeater控件来显示数据. 实现DataList或Repeater控件的分页显示有几种方法: 1.写一个方法或存储过程,根据传入的页数返回需要显示的数据表(DataTable) 2.使用PagedDataSource类(位

  • .NET实现Repeater控件+AspNetPager控件分页

    当然首先你要把bin文件放进你的项目,并加到你的工具栏去 //页头需引用的 <%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %> 控件部分(格式已经设计好) <webdiyer:AspNetPager ID="AspNetPager1" runat="server" Alw

  • 在ASP.NET 2.0中操作数据之四十一:DataList和Repeater数据分页

    导言 分页和排序是显示数据时经常用到的功能.比如,在一个在线书店里搜索关于ASP.NET 的书的时候,可能结果会是成百上千,而每页只列出十条.而且结果可以根据title(书名),price(价格),page count(页数),author name(作者)等来排序.我们在分页和排序报表数据 里已经讨论过, GridView, DetailsView, 和FormView 都有内置的分页功能,仅仅只需要勾一个checkbox就可以开启.GridView 还支持内置的排序. 不幸的是,DataLi

  • asp.net repeater手写分页实例代码

    复制代码 代码如下: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using BLL; using Model; using System.Data.SqlClient; using System.Data; public partial class Test_Re

  • .NET中的repeater简介及分页效果

    Repeater控件是一个数据绑定容器控件,它能够生成各个项的列表,并可以使用模板定义网页上各个项的布局.当该页运行时,该控件为数据源中的每个项重复此布局. 配合模板使用repeater控件 若要使用repeater控件,需创建定义控件内容布局的模板.模板可以包含标记和控件的任意组合.如果未定义模板,或者模板都不包含元素,则当应用程序运行时,该控件不显示在页面上. ItemTemplate : 含要为数据源中每个数据项都要呈现一次的 HTML 元素和控件. AlternatingItemTemp

  • asp.net中让Repeater和GridView支持DataPager分页

    改造办法是自己写一个控件,让它继承GridView或Repeater,并实现IPageableItemContainer 接口.下面要发的是国外某高手写的代码,测试有效.具体使用的时候,要建一个类库项目,把代码编译成dll后,就可以添加到VS的工具箱里了! 一.自定义Repeater 复制代码 代码如下: using System.Web.UI; using System.Web.UI.WebControls; namespace WYJ.Web.Controls { /// <summary>

  • asp.net中使用repeater和PageDataSource搭配实现分页代码

    复制代码 代码如下: PagedDataSource objPage = new PagedDataSource(); DataView dv = bllBook.GetListByState("", true);            //设置数据源            objPage.DataSource =dv ; //允许分页            objPage.AllowPaging = true; //设置每页显示的项数            objPage.PageS

  • ASP.NET程序中用Repeater实现分页

    一.程序功能: 为Repeater实现分页 二.窗体设计: 1.新建ASP.NET Web应用程序,命名为Repeater2,保存路径为http://192.168.0.1/Repeater2(注:我机子上的网站的IP是192.168.0.1的主目录是D:\web文件夹)然后点击确定. 2.向窗体添加一个3行一列的表,向表的第一行中添加一个Repeater控件,向表的第二行中添加两个Label控件向表的第三行中添加四个Button按钮. 3.切换到HTML代码窗口,在<asp:Repeater

  • asp.net Repeater之非常好的数据分页

    分页控件源代码如下: 复制代码 代码如下: 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 Attribut

  • asp.net Repeater控件的说明及详细介绍及使用方法

    Repeater 控件不具备内置的呈现功能,这表示用户必须通过创建模板为 Repeater 控件提供布局.当该页运行时,Repeater 控件依次通过数据源中的记录为每个记录呈现一个项. 他很简单,用起来也不够强大,但是应了那句老话,杀鸡焉用牛刀,不用牛刀那用什么呢?难道我们去把鸡咬死不成?而我们在日常应用中也常常面临这样的选择,假设我们显示教复杂的数据,可以用gridview,一般复杂的用DataList,那么简单的数据呈现呢?我们就用Repeater了,因为他简单,小巧,最主要是灵活. 我们

  • ASP.NET Mvc开发之删除修改数据

    之前那篇文章介绍了ASP.NET MVC使用EF来查询数据和EF中DbQuery<T>泛型对象对数据的延迟加载.今天我们就来看看我们怎么使用EF来删除数据. 其实现在的Web开发通用的模式就是前端使用Js和JQuery来和后端进行数据交互.那么我们就在前端来加两个删除和更新的脚本.代码如下: <!--遍历 Action方法 设置给 ViewData 的集合数据,生成HTML代码--> @foreach (BlogArticle a in ViewData["DataLis

  • asp.net+jquery滚动滚动条加载数据的下拉控件

    这样的需求貌似自己感觉不是很合理,因为数据多了如此下拉无论从人还是机器操作都比较痛苦. 没办法由于需求下来了,只能按需求操作.网上找了很多相关控件都感觉有点庞大,占资源比较多.没办法自己花半天时间弄出个半成品自定义控件,拿出来分享下,如有高手看了请多指点. 需求:AJAX滚动滚动条加载数据的下拉列表 控件名称:Webcombo 所用技术:ASP.NET(C#),jQuery,ASP.NET一般处理文件(.ashx) 下拉列表具体实现:用DIV模拟下拉列表,input和图片模拟下拉框.最终结果如下

  • ASP.NET MVC5 网站开发框架模型、数据存储、业务逻辑(三)

    前面项目的层次和调用关系都说明了,关系如下图 采用三层架构的时候,研究过BLL层的必要性,觉得业务逻辑完全可以在controller里实现,没有必要单独做一个项目,另一个分层多了会影响性能.后来我还是把业务逻辑独立出来,原因如下: 业务逻辑写进controller里代码看着比较混乱,时间久了代码容易理不清. 在controller里直接写逻辑重复代码会不较多,开发效率低. 分项目有利于代码重用,有时候可以直接拿到其他项目中稍作修改就可以用. 对于性能我觉得分层多了肯定会有影响,但是不会很大.现在

  • Asp.net配合easyui实现返回json数据实例

    本文实例讲述了Asp.net配合easyui实现返回json数据的实现方法.分享给大家供大家参考.具体如下: 最近想用asp.net配合easyui开发一个小框架,然后再用到easyui的combobox的时候出现了一个问题,总所周知,easyui的文档上给出的combobox的格式是 复制代码 代码如下: <input class="easyui-combobox"               name="language"              dat

  • ASP.NET repeater添加序号列的方法

    在项目开发过程中,会经常遇到ASP.NET repeater控件添加序号列,有些新手可能还不会,网上搜集整理了一些,需要的朋友可以参考下 ASP.NET repeater添加序号列的方法 1.<itemtemplate> <tr><td> <%# Container.ItemIndex + 1%> </td></tr> </itemtemplate> 2.<itemtemplate> <tr><

  • Asp.Net使用Bulk实现批量插入数据

    本文实例讲述了Asp.Net使用Bulk实现批量插入数据的方法,分享给大家供大家参考之用.具体方法如下: 主要功能代码如下: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Diagnostics; using System.Data; using System.Data.SqlClient; using System.Configuration;

  • asp的通用数据分页类

    (原创)<!--#include file="Conn.asp" --> 通用数据分页类     通用分页类,以后写分页显示数据时就轻松多啦.直接调用此类,然后再Execute即可以取得当前页的所有数据.     此类所做的工作是只取得当前页的数据,和总页数和总记录数等等数据. ASP代码: <% '/*****************************分页显示类************************** '/* 作者:哇哇鱼 '/* 日期:2004年

随机推荐