惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
Securelist
O
OpenAI News
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
T
Threat Research - Cisco Blogs
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Google Online Security Blog
Google Online Security Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
N
News and Events Feed by Topic
S
Security Affairs
SecWiki News
SecWiki News
Project Zero
Project Zero
L
Lohrmann on Cybersecurity
P
Proofpoint News Feed
P
Palo Alto Networks Blog
L
LINUX DO - 最新话题
H
Hacker News: Front Page
Recent Commits to openclaw:main
Recent Commits to openclaw:main
I
Intezer
Simon Willison's Weblog
Simon Willison's Weblog
W
WeLiveSecurity
T
The Exploit Database - CXSecurity.com
K
Kaspersky official blog
The GitHub Blog
The GitHub Blog
I
InfoQ
云风的 BLOG
云风的 BLOG
雷峰网
雷峰网
B
Blog
IT之家
IT之家
AWS News Blog
AWS News Blog
Jina AI
Jina AI
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Google DeepMind News
Google DeepMind News
Spread Privacy
Spread Privacy
N
News and Events Feed by Topic
Security Latest
Security Latest
美团技术团队
C
Check Point Blog
WordPress大学
WordPress大学
T
Tenable Blog
S
Security @ Cisco Blogs
Last Week in AI
Last Week in AI
博客园 - 聂微东
月光博客
月光博客
博客园 - 【当耐特】
S
Schneier on Security
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
S
Secure Thoughts
Schneier on Security
Schneier on Security
C
Cisco Blogs
Cyberwarzone
Cyberwarzone

博客园 - 七玄门

千万级通用的分页存储过程3 设置google搜索框默认文本 jQuery 表格插件 不再限于页面脚本 JavaScript挺入服务器端开发语言序列 实用的 JavaScript 测试及效验工具 那些相见恨晚的 JavaScript 技巧 一个简单功能的google地图 无法在Web服务器上启动调试。与Web服务器通信时出现身份验证错误 url重写—适用html为伪静态后真实的html无法访问的解决方法 - 七玄门 - 博客园 禁用浏览器缓存 - 七玄门 - 博客园 google搜索框添加关键字 千万数量级分页存储过程2(可支持多表查询,任意排序) 千万数量级分页存储过程1 js实现tab原理 http返回网页状态码查询 IIS 实现资源永久重定向(301)的常见参数 利用JS解决IE6PNG不透明 验证码生成示例 利用JavaScript更改input中radio和checkbox样式
翻页用户控件-1 - 七玄门 - 博客园
七玄门 · 2009-11-06 · via 博客园 - 七玄门

本人新建提供上门服务的网站:我爱上门网,欢迎朋友们指点一二。

<%@ Control Language="C#" AutoEventWireup="true" Inherits="System.Web.UI.UserControl" %>
<style type="text/css">
    ul { list-style:none;}
    #pagelist { width:100%; padding:6px 0px; height:20px;font-size:12px;font:12px/1.5em Tahoma,Verdana,Simsun,Microsoft YaHei,Arial Unicode MS,Mingliu,Arial,Helvetica;}
    #pagelist ul li { float:left; border:1px solid #FEBD5C; height:20px; line-height:20px; margin:0px 2px;}
    #pagelist ul li a, .pageinfo { display:block; padding:0px 6px; background:#FFF8E1;color:Black;text-decoration:none;}
    #pagelist ul li a:hover { color:#6F5C4E;background-color:#D7F1FF;}
    .pageinfo  { color:#555;}
    .current { background:#FED596; display:block; padding:0px 6px; font-weight:bold;}
</style>
<label id="PageControls1" runat="server"></label>
<script runat="server">
    #region 属性
    int pageindex = 1;
    /// <summary>
    /// 当前页
    /// </summary>
    public int PageIndex
    {
        get { return pageindex; }
        set { pageindex = value; }
    }
    int pagecount = 0;
    /// <summary>
    /// 记录总数
    /// </summary>
    public int PageCount
    {
        get { return pagecount; }
        set { pagecount = value; }
    }
    int pagesize = 10;
    /// <summary>
    /// 每页显示记录条数
    /// </summary>
    public int PageSize
    {
        get { return pagesize; }
        set { pagesize = value; }
    }

    string filename = "";
    /// <summary>
    /// 文件名
    /// </summary>
    public string FileName
    {
        get { return filename; }
        set { filename = value; }
    }
    #endregion

    protected void Page_Load(object sender, EventArgs e)
    {
        PageData();
    }

    private void PageData()
    {
        int notepage = 0;   //总页数

        System.Text.StringBuilder sb = new System.Text.StringBuilder();
        sb.Append("<div id=\"pagelist\">");
        sb.Append("<ul>");
        if (FileName == "")
        {
            sb.Append("<li><a href=\"?page=1\">第一页</a></li>");
        }
        else
        {
            sb.Append("<li><a href=\"" + FileName + "&page=1\">第一页</a></li>");
        }

        if (PageCount % PageSize == 0)
        {
            notepage = PageCount / PageSize;
        }
        else
        {
            notepage = PageCount / PageSize + 1;
        }

        for (int i = 1; i <= notepage; i++)
        {
            if (notepage > 7)
            {
                if (i < (PageIndex - 7))
                {
                    i = PageIndex - 7;
                }
                else if (i > (PageIndex + 6) && (i < notepage))
                {
                    break;
                }
            }

            if (PageIndex == i)
            {
                sb.Append("<li class=\"current\">" + i + "</li>");
            }
            else
            {
                if (FileName == "")
                {
                    sb.Append("<li><a href=\"?page=" + i + "\">").Append(i).Append("</a></li>");
                }
                else
                {
                    sb.Append("<li><a href=\"" + FileName + "&page=" + i + "\">").Append(i).Append("</a></li>");
                }
            }
        }

        if (FileName == "")
        {
            sb.Append("<li><a href=\"?page=" + notepage + "\">最后一页</a></li>");
            sb.Append("<li class=\"pageinfo\">第" + PageIndex + "页/共" + notepage + "页</li>");
        }
        else
        {
            sb.Append("<li><a href=\"" + FileName + "&page=" + notepage + "\">最后一页</a></li>");
            sb.Append("<li class=\"pageinfo\">第" + PageIndex + "页/共" + notepage + "页</li>");
        }
        sb.Append("</ul>");
        sb.Append("</div>");

        //Response.Write(sb.ToString());
        PageControls1.InnerHtml = sb.ToString();
    }
</script>