• wenfrom 分页


    分页有很多控件之类的~~~现在暂时发个临时版,可以用来扩展为控件之类的,懒的扩展了

    #region 分页
    int total = (int)Math.Ceiling(pageCount / (double)pageSize);
    string url = "/sitemap-" + type.ToString().ToLower() + "-" + "{0}" + ".html ";
    if (total == 1)
    {
    PageIndexHtml = string.Empty;
    }
    else
    {
    StringBuilder sb = new StringBuilder();
    if (this.pageIndex > 1)
    sb.AppendFormat("<a class=\"c_up_nocurrent\" href=\"{0}\">上一页</a>", string.Format(url, this.pageIndex - 1));
    sb.Append("<div class=\"c_page_list layoutfix\">");

    int jspageSize = 10;
    int jsPageIndex = this.pageIndex - 5 < 0 || total <= jspageSize ? 0 : this.pageIndex - 5;
    if (jsPageIndex + 10 > total && total - jspageSize > 0) jsPageIndex = total - jspageSize;

    int jsPageEnd = jsPageIndex + 10;
    if (jsPageEnd > total) jsPageEnd = total;
    if (jsPageIndex > 0)
    {
    sb.AppendFormat("<a class=\"{0}\" href=\"{1}\">{2}</a>", "", string.Format(url, 1), 1);
    sb.Append("<span class=\"c_page_ellipsis\">...</span>");
    }
    for (int i = jsPageIndex; i < jsPageEnd; i++)
    {
    sb.AppendFormat("<a class=\"{0}\" href=\"{1}\">{2}</a>", this.pageIndex == i + 1 ? "current" : "", string.Format(url, i + 1), i + 1);
    }
    if (jsPageEnd != total)
    {
    sb.Append("<span class=\"c_page_ellipsis\">...</span>");
    sb.AppendFormat("<a class=\"{0}\" href=\"{1}\">{2}</a>", "", string.Format(url, total), total);
    }
    sb.Append("</div>");
    if (this.pageIndex < total)
    sb.AppendFormat("<a class=\"c_down\" href=\"{0}\">下一页</a>", string.Format(url, this.pageIndex + 1));
    sb.Append("<div class=\"c_pagevalue\">到<input id=\"pageNum\" type=\"text\" class=\"c_page_num\" name=\"\" />页");
    string js = @"var pageTolal= " + total + @"; var pageNum=_.$('pageNum');
    if (/^\d+$/.test(pageNum.value)){
    if(parseInt(pageNum.value) > pageTolal){
    $alert(pageNum, $s2t('超出页码范围!'));}
    }else{
    $alert(pageNum, $s2t('请输入正确的页码!'));
    }
    window.location.href = '/sitemap-" + type.ToString().ToLower() + @"-'+pageNum.value+'.html';
    ";
    sb.AppendFormat("<input type=\"button\" class=\"c_page_submit\" onclick=\"{0}\" value=\"确定\" name=\"\" /></div>", js);
    PageIndexHtml = sb.ToString();
    }
    #endregion

  • 相关阅读:
    8.Http的状态码有哪些
    6、<!DOCTYPE>声明是什么意思
    6.px和em的区别
    5、什么叫优雅降级和渐进增强
    3、简述src和href的区别;@import和link的区别
    2、行内元素有哪些?块级元素有哪些? 空(void)元素有那些?行内元素和块级元素有什么区别?
    1、盒模型理解
    requests学习(一)——get请求
    【Flutter】功能型组件之跨组件状态共享
    【Flutter】功能型组件之数据共享
  • 原文地址:https://www.cnblogs.com/qionghua/p/2565271.html
Copyright © 2020-2023  润新知