下面这样的table如何进行分页,先是获取了所有title的内容,然后递增进行显示。求可行的代码。
<table id="table2" class="t" cellspacing="0" cellpadding="0" width="80%" id="ajaxtable" align="center">
<tr>
<th class="h" colspan="5" style="width: 100%; height: 20px;">
<a href="">
<%=KindClass.getName(Convert.ToInt32(kindid))%></a>
</th>
</tr>
<tr class="tr2">
<td width="6%" style="height: 23px">
</td>
<td width="58%" style="height: 23px">
主题
</td>
<td width="13%" style="height: 23px">
作者
</td>
<td width="10%" style="height: 23px">
回复/查看
</td>
<td width="13%" style="height: 23px">
最后回复
</td>
</tr>
<%
DsTitle = TitleClass.getTitleArray();
for (int i = 0; i < DsTitle.Tables[0].Rows.Count; i++)
{
titleid = DsTitle.Tables[0].Rows[i]["title_id"].ToString();
%>
<tr class="tr3 f_one" onmouseover="this.className='tr3 f_two'" onmouseout="this.className='tr3 f_one'">
<td class="tal">
<img src="images/BBS/topicnew.gif" style="width: 21px; height: 21px" />
</td>
<td class="tals">
<h3>
<a href="DisplayReply.aspx?titleid=<%=titleid%>&page=1">
<%=DsTitle.Tables[0].Rows[i]["title"].ToString()%>
</a>
</h3>
</td>
<td class="tals">
<span class="f10"> <%=loginUser.getloginUserName(useid)%></span><br />
<span class="f10 gray">
<%=DsTitle.Tables[0].Rows[i]["title_uptime"].ToString()%></span>
</td>
<td class="tals f10">
<%=DsTitle.Tables[0].Rows[i]["Reply_count"].ToString()%>/<%=DsTitle.Tables[0].Rows[i]["click_count"].ToString()%>
</td>
<td class="tals" >
<span class="f10">
<%=loginUser.newReplyUserinName(titleid)%>
</a></span>
<br />
<span class="f10 gray" style="text-align: left">
<%=ReplyClass.newReplyTime(titleid)%></span>
</td>
</tr>
<%
}
%>
</table>
<div style="width:80%;margin-left:114px">
<span id="spanFirst" class="span green">第一页</span> <span id="spanPre" class="span green">上一页</span> <span id="spanNext" class="span green">下一页</span> <span id="spanLast" class="span green">最后一页</span> 第<span id="spanPageNum"></span>页/共<span id="spanTotalPage"></span>页
</div>

你这个可以通过url分页,pageno传到后台,后台经过数据筛选,前台展示,浏览器渲染。
asp.net的话推荐一个分页控件aspnetpager。http://www.webdiyer.com/urlpagerdemo/repeater/page/2/
你可以使用第三方的表格组件,都支持分页,比如jquery的jqGrid
你可以考虑控制循环的 i 值范围 一般都是直接后台查询语句真分页的