給repeater分頁

來源:互聯網
上載者:User
Code:
  1. //給repeater分頁主要是sql語句查出   
  2. select top(1) * from tbGGao where  ggId>16   
  3. select top(1) * from tbGGao where  ggid<29 order by ggId desc   
  4.  private void BindRep()   
  5.     {   
  6.         int reqid = Convert.ToInt32(Request.QueryString["tid"]);   
  7.         DataSet ds = BGGao.GetList(" ggId='" + reqid + "' order by ggTime");   
  8.         Repeater1.DataSource = ds;   
  9.         Repeater1.DataBind();   
  10.         int maxid = BGGao.GetMaxId() - 1;   
  11.         int minId = BGGao.GetMinId();   
  12.         ds = BGGao.GetTop1(" ggid>"+reqid+"");   
  13.         if (reqid == maxid)//傳過來的編號是最大的就沒有上一篇咯   
  14.         {   
  15.             HLKNext.NavigateUrl = "";   
  16.             HLKNext.Text = "沒有啦";   
  17.         }   
  18.         if (reqid < maxid && ds.Tables[0].Rows.Count > 0)//如果傳來的編號小於最大編號可能有下一篇   
  19.         {   
  20.             string bianhao = ds.Tables[0].Rows[0][0].ToString();   
  21.             HLKNext.NavigateUrl = "ShowGGao.aspx?tid=" + bianhao + "";   
  22.             HLKNext.Text = ds.Tables[0].Rows[0][1].ToString();   
  23.         }   
  24.         ds = BGGao.GetTop1(" ggid<" + reqid + " order by ggId desc");   
  25.         if (reqid == minId)   
  26.         {   
  27.             HyperLink2.NavigateUrl = "";   
  28.             HyperLink2.Text = "沒有啦";   
  29.         }   
  30.         if (ds.Tables[0].Rows.Count > 0 && minId < reqid)   
  31.         {   
  32.             string bianhao = ds.Tables[0].Rows[0][0].ToString();   
  33.             HyperLink2.NavigateUrl = "ShowGGao.aspx?tid=" + bianhao + "";   
  34.             HyperLink2.Text = ds.Tables[0].Rows[0][1].ToString();   
  35.         }   
  36.     }              

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.