国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > ASP > 正文

像Asp一樣輕松分頁顯示數(shù)據(jù)(C#)

2024-05-04 11:06:35
字體:
供稿:網(wǎng)友

代碼如下:

<%@ page language="c#" debug="true" %>
<%@import namespace="system.data"%>
<%@import namespace="system.data.sqlclient"%>
<script language="c#" runat="server">
int record_per_page;//定義每頁顯示記錄數(shù)
int npagecount;//定義總頁數(shù)
int nreccount;//定義總記錄數(shù)
int npage;//定義當(dāng)前頁
void page_load(object src,eventargs e){
//取得當(dāng)前頁數(shù)值,并判斷
if(request["pagesize"]==null)
record_per_page=9;
else
record_per_page=convert.toint32(request["pagesize"]);
//連接數(shù)據(jù)庫
sqlconnection conn;
conn =new sqlconnection(configurationsettings.appsettings["strconn"]);
conn.open();

//執(zhí)行sql語句
string connstr="select id,name,demo,pic from download where classid=23 or classid=24 order by time desc";
sqldataadapter odadapt = new sqldataadapter(connstr,conn);
dataset ds = new dataset();
odadapt.fill(ds);
datatable dt = ds.tables[0];
//獲得總記錄數(shù)
nreccount = dt.rows.count;

//判斷是否存在數(shù)據(jù)記錄
if(nreccount > 0){
//確定數(shù)據(jù)記錄要顯示的頁面數(shù)
  npagecount=nreccount/record_per_page;
if(nreccount % record_per_page > 0)
 npagecount ++;
if(npage < 1)
    npage = 1;
if(npage > npagecount)
    npage = npagecount;
//將頁數(shù)顯示到屏幕上,并作鏈接
for(i=1;i<=npagecount;i++){
   html=html+"<a href='mblist.aspx?page="+i+"&id="+classid+"&classname="+request.params["classname"]+"pagesize="+record_per_page+"'>";
   if(i==npage)
   html=html+"<b>"+i+"</b>";
   else
   html=html+i;
   html=html+"</a> ";
  }
  pagelist.innerhtml=html;
  html="";
//確認(rèn)當(dāng)前頁面的開始記錄和終止記錄
  int nstart = record_per_page * (npage - 1);
  int nend = nstart + record_per_page - 1;
if(nend > nreccount - 1)
    nend = nreccount - 1;
//在屏幕中輸出記錄
  html="<table border='0' cellpadding='0' cellspacing='0' style='border-collapse: collapse' bordercolor='#111111' width='95%' height='139' bgcolor='#ffffff'><tr>";
  int j=0;
  for(i=nstart;i<=nend;i++){
    html+="<td align=center height=180 ><table border='0' cellpadding='0' cellspacing='0' style='border-collapse: collapse' bordercolor='#111111' width='145'><tr><td align=center><img src='http://bbs.wrclub.net/templates/"+dt.rows[i]["demo"].tostring().trim()+"/"+dt.rows[i]["pic"].tostring().trim()+"' height=143 width=140 border=0 alt='"+dt.rows[i]["name"].tostring().trim()+"'></td></tr><tr><td width='100%' background='images/mbbg.gif'><table border='0'cellpadding='0'cellspacing='0'width='100%'><tr><td width='50%'><a target='_blank'><img src='http://www.pushad.com/info/images/view.gif' border=0></a></td><td width='50%' align=right><a href='mbdown.aspx?id="+dt.rows[i]["id"]+"' target=_blank><img src='http://www.pushad.com/info/images/down.gif' border=0></a></td></tr></table></td></tr></table></td>";
    j++;
    if(j%3==0)
    html+="</tr><tr>";
 }
  html+="</tr></table>";
  mblist.innerhtml=html;
  html="";
}
conn.close();
}
</script>

 

<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<title><%=request.params["classname"]%>:網(wǎng)人俱樂部</title>
<meta name="keywords" content="學(xué)習(xí),免費(fèi)資源,asp,jsp,flash,photoshop,社區(qū),論壇,同學(xué)錄,電子圖書,網(wǎng)站建設(shè),宣傳,推廣,聊天,數(shù)據(jù)庫,經(jīng)驗(yàn)心得,游戲,game,電子超市,網(wǎng)人交流論壇,插件,下載">
<meta name="description" content="提供網(wǎng)站建設(shè)、開發(fā)方面的學(xué)習(xí)資料、經(jīng)驗(yàn)心得,同時提供免費(fèi)的電子書籍、網(wǎng)站免費(fèi)資源、制作工具、插件、濾鏡,網(wǎng)站還有網(wǎng)上電子超市、論壇、網(wǎng)人交流論壇">
<link rel="stylesheet" type="text/css" href="style.css"><link rel="shortcut icon" href="favicon.ico">
</head>
<body topmargin="0" leftmargin="0"><form runat=server action="?id=22&classname=模板中心">
<!-- #include file="top.inc" -->
<div align="center">
  <center>
    <table border="0" cellpadding="0" cellspacing="0" bordercolor="#111111" width="778" height="92">
      <tr>
        <td width="375" height="92" rowspan="2"><img src="images/wrclub_l<%=request.params["id"]%>.jpg" width="375" height="92">
        </td>
      <td height="24" width="403" background="images/bg3.gif"> <span id="myclass" runat="server"></span></td>
    </tr>
    <tr>
        <td width="403" height="68" valign="top">
          <!-- #include file="bbslogin.inc" --> </td>
    </tr>
  </table>
    <table width="778" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="20" background="http://www.pushad.com/info/images/bg5.gif"><img src="http://www.pushad.com/info/images/bg5.gif" width="7" height="24"></td>
      </tr>
    </table>
    <table width="778" border="0" cellpadding="0" cellspacing="0" bgcolor="#d8d8d8">
      <tr>
          <td width="562" height="400" align="center" valign="top">
    <table width="95%" border="0" cellspacing="0" cellpadding="0" bgcolor="#ffffff">
              <tr>
                <td width="37%"> &nbsp;<img src="http://www.pushad.com/info/images/favorites.gif" width="16" height="16">
                  <a href="default.aspx">網(wǎng)人俱樂部</a> -- 模板中心</td>
                <td width="63%" align=center>·共有模板 <%=nreccount%> 個 ·共有 <%=npagecount%>
                  頁 ·每頁顯示
            <select id=select21 size=1 name="pagesize" onchange="var url=this.options[this.selectedindex].value; if(url!='') {self.location=url;} else {this.selectedindex=0;}" tabindex="1">
            <option value="?id=22&classname=模板中心&page=<%=npage%>&pagesize=9" ><font face="arial">9 </font></option>
            <option value="?id=22&classname=模板中心&page=<%=npage%>&pagesize=12"><font face="arial">12</font></option>
            <option value="?id=22&classname=模板中心&page=<%=npage%>&pagesize=15"><font face="arial">15</font></option>
            <option value="?id=22&classname=模板中心&page=<%=npage%>&pagesize=18"><font face="arial">18</font></option>
            <option value="?id=22&classname=模板中心&page=<%=npage%>&pagesize=21"><font face="arial">21</font></option></select>個</td>
  </tr>
</table>
 <span id="mblist" runat="server"></span>
            <table width="95%" border="0" cellspacing="0" cellpadding="0" bgcolor="#ffffff">
              <tr>
                <td height="16" align=center> <span id="pagelist" runat="server" ></span> </td>
              </tr>
</table><br>
 </td>
        <td width="216" valign="top">
          <table width="202" height="100%" border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td width="5" height="100%" valign="top" background="images/yy_bg.gif"><img src="http://www.pushad.com/info/images/yy1_bg.gif" width="8" height="16"></td>
              <td width="193" height="100%" bgcolor="#ffffff" valign="top">
     <table width="100%" border="0" cellspacing="0" cellpadding="0" height="24"

bordercolor="#111111">
  <tr>
    <td align="center">下載排行</td>
  </tr>
</table><br>
<span id="downhot" class="p1" runat="server"></span></td>
              <td width="5" height="100%" valign="top" background="images/yy_bg1.gif"><img src="http://www.pushad.com/info/images/yy1_bg1.gif" width="9" height="15"></td>
            </tr>
          </table></td>
      </tr>
    </table>
        <table border="0" cellpadding="0" cellspacing="0" bordercolor="#111111" width="778" height="1">
      <tr>
        <td background="images/nod0a.gif"></td>
      </tr>
    </table>
    <!-- #include file="footer.inc" -->
  </center>
</div></form>
</body></html>

 


發(fā)表評論 共有條評論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 马关县| 彩票| 乐东| 东乌| 宁明县| 博湖县| 寿阳县| 丹巴县| 英德市| 遵化市| 烟台市| 深泽县| 呼图壁县| 洱源县| 乌拉特中旗| 嘉荫县| 福建省| 遂溪县| 桐柏县| 湖口县| 玉龙| 屯昌县| 淮滨县| 库伦旗| 罗定市| 吴桥县| 宁乡县| 嘉禾县| 香河县| 靖宇县| 浦城县| 略阳县| 哈巴河县| 临高县| 东乡族自治县| 桦南县| 临澧县| 仙居县| 盘锦市| 沧源| 海安县|