zoukankan      html  css  js  c++  java
  • 分页

    public List<userinfo> fenye(int pagesize,int nowpage,string table)
    {
    using (testDataContext db = new testDataContext())
    {
    string sql = string.Format("select top {0}*{1} * from {2} where id not in (select top ({3}-1)*{4} id from {5})",nowpage,pagesize,table,nowpage,pagesize,table);
    return db.ExecuteQuery<userinfo>(sql).ToList();
    }
    }
    public string fenyestr(int pagesize, int nowpage,int count)
    {
    string str = "";
    str += "<a onclick='load(1)'>首页</a><a onclick='load("+(nowpage-1)+")'>上一页</a>";
    if (nowpage < 4)
    {
    str += "<a onclick='loan(1)'>1</a><a onclick='loan(2)'>2</a><a onclick='loan(3)'>3</a><a onclick='loan(4)'>4</a><a onclick='loan(5)'>5</a>";
    }
    else
    {
    str += "<a onclick='loan(" + (nowpage - 2) + ")'>" + (nowpage - 2) + "</a><a onclick='loan(" + (nowpage - 1) + ")'>" + (nowpage - 1) + "</a><a onclick='loan(" + nowpage + ")'>" + nowpage + "</a><a onclick='loan(" + (nowpage+1) + ")'>" + (nowpage+1) + "</a><a onclick='loan(" + (nowpage+2) + ")'>" + (nowpage+2) + "</a>";
    }
    str += "<a onclick='"+(nowpage+1)+"'>下一页</a><a onclick='"+(count/pagesize+1)+"'>尾页</a>";
    str += "<input id='page' type='text' /><input type='button' value='跳转' onclick='go()' />";
    return str;
    }

  • 相关阅读:
    停滞的代码
    民兵葛二蛋大结局
    该开始BS了
    今天写出了第一个.NetBS应用
    读源码,仿照
    MVN,老天怎么回事?
    从哪里入手
    学习Java了
    工厂方法模式与简单工厂
    转:悟透JavaScript
  • 原文地址:https://www.cnblogs.com/jianghaidong/p/4799691.html
Copyright © 2011-2022 走看看