选择显示字体大小

像asp一样轻松分页显示数据c#

代码如下<%@ page language="c#" debug="true" %>
<%@import namespace="system.data"%>
<%@import namespace="system.data.sqlclient"%>
<script language="c#" runat="server">
int record_per_page;//定义每页显示记录数
int npagecount;//定义总页数
int nreccount;//定义总记录数
int npage;//定义当前页
void page_load(object src,eventargs e){
//取得当前页数值,并判断
if(request["pagesize"]==null)
record_per_page=9;
else
record_per_page=convert.toint32(request["pagesize"]);
//连接数据库
sqlconnection conn;
conn =new sqlconnection(configurationsettings.appsettings["strconn"]);
conn.open();

//执行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];
//获得总记录数
nreccount = dt.rows.count;

//判断是否存在数据记录
if(nreccount > 0){
//确定数据记录要显示的页面数
  npagecount=nreccount/record_per_page;
if(nreccount % record_per_page > 0)
 npagecount ++;
if(npage < 1)
    npage = 1;
if(npage > npagecount)
    npage = npagecount;
//将页数显示到屏幕上,并作链接
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="";
//确认当前页面的开始记录和终止记录
  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 href='http://bbs.wrclub.net/templates/"+dt.rows[i]["demo"].tostring().trim()+"/' target='_blank'><img src='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='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"]%>:网人俱乐部</title>
<meta name="keywords" content="学习,免费资源,asp,jsp,flash,photoshop,社区,论坛,同学录,电子图书,网站建设,宣传,推广,聊天,数据库,经验心得,游戏,game,电子超市,网人交流论坛,插件,下载">
<meta name="description" content="提供网站建设、开发方面的学习资料、经验心得,同时提供免费的电子书籍、网站免费资源、制作工具、插件、滤镜,网站还有网上电子超市、论坛、网人交流论坛">
<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" style="border-collapse: collapse" 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="images/bg5.gif"><img src="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="images/favorites.gif" width="16" height="16">
                  <a href="default.aspx">网人俱乐部</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;}" style="font-size: 9pt; font-family: 宋体; background-color: #b6b1cb; color: #000000" 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="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"

style="border-collapse: collapse; border-left-width: 1; border-right-width: 1; border-top-width:

1; border-bottom-style: solid; border-bottom-width: 1" 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="images/yy1_bg1.gif" width="9" height="15"></td>
            </tr>
          </table></td>
      </tr>
    </table>
        <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="778" height="1">
      <tr>
        <td background="images/nod0a.gif"></td>
      </tr>
    </table>
    <!-- #include file="footer.inc" -->
  </center>
</div></form>
</body></html>

 


 


关键字 本文所属关键字

相关 与本文相关文章

分类 所有文章关键字导航

源码编程相关

Java   Asp   PHP   .Net   XML   C/C++   CGI   VB   Jsp   J2ee   J2se   J2me   EJB   Servlet   Tomcat   Resin   Struts   Weblogic   Eclipse   ANT   GUI   JMS   Web servise   IDEA   Webphere   Hibernate   Spring   Jboss   Applet   Swing   Socket   Javamail   Perl   Ajax   P2P   安全   模式   框架   测试   开源   游戏

SQL数据库相关

My-SQL   Ms-SQL   Access   DB2   Oracle   Sybase   SQLserver   索引   存储过程   加密   数据库   分页   视图  

手机无线相关

3G   Wap   CDMA   GRPS   GSM   IVR   彩信   短信   无线   增值业务

网页设计制作相关

HTML   CSS   网页配色   网页特效   Javascript   VBscript   Dreamweaver   Frontpage   JS   Web   网站设计

网站建设推广相关

建站经验   网站优化   网站排名   推广   Alexa

操作系统/服务器相关

Windows XP   Windows 2000   Windows 2003   Windows Me   Windows 9.x   Linux   UNIX   注册表   操作系统   服务器   应用服务器

图形图像多媒体相关

Photoshop   Fireworks   Flash   Coreldraw   Illustrator   Freehand   Photoimpact   多媒体   图形图像

标准 网站致力的规范

Valid CSS!

无不良内容,无不良广告,无恶意代码

Valid XHTML 1.0 Transitional

creativecommons