asp.net Repeater之非常好的数据分页
程序员文章站
2024-03-11 11:58:43
分页控件源代码如下: 复制代码 代码如下: using system; using system.collections.generic; using system.com...
分页控件源代码如下:
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
}
}
}
复制代码 代码如下:
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
}
}
}