注册 登录
编程论坛 ASP技术论坛

asp能否控制表格的行数,高人指点下。(已解决)

letla 发布于 2007-12-26 22:00, 833 次点击
我想实现每页的表格行数都30行,不管当前页的记录数是否够30条。
一条记录一行,不够30条的自动补够30行。。。
高人指点下啊。。。这样的效果能否实现啊?

[[italic] 本帖最后由 letla 于 2007-12-27 09:38 编辑 [/italic]]
3 回复
#2
madpbpl2007-12-26 23:53
rs.pagesize=30
page=request("page")
if page="" then
page=1
end if
do while not rs.eof and i<=rs.pagesize
<tr><td>你的输出对象</td></tr>
loop
if rs.pagecount <30 then
for i=rs.pagecount+1 to 30
<tr><td>&nbsp;</td></tr>
next
end if
试试这样行不行
#3
xmuer2007-12-26 23:56
看看我写的这个,有点麻烦,但是可以用的。。
具体的效果就是[url]www.[/url]左边的部分!
程序代码:
<%sql="select * from info order by time desc"
set rs= Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,3,3%>

<table id="newstable" style="DISPLAY: block" cellspacing="0"
cellpadding="0" width="214" align="center" border="0">
                    <tbody>
                      <tr>
                        <td class="txtcolor" colspan="2" height="4"></td>
                      </tr>
                     <%if rs.recordcount<6 then
                      for i=1 to rs.recordcount%>
                        <tr>
                        <td class="txtcolor" align="middle" width="14"
                            height="26"><img src="jhd/left.gif" border="0"></td>
                        <td><a href="view_info.asp?id=<%=rs("id")%>" target="_blank" class="txtcolor">
                     <%  If Len(rs("title"))>20 Then
                Response.Write Leftb(rs("title"),20) & "…"
            Else
                Response.Write rs("title")
            End If%>
                      </a></td>
                      </tr>
                    
                      <tr>
                        <td background="jhd/legend.gif"
                            colspan="2" height="1"></td>
                      </tr>

                      <%rs.movenext%>
                      <%next%>
                      <%for j=1 to 6-rs.recordcount%>
                      <tr><td class="txtcolor" align="middle" width="14" height="26"><img src="jhd/left.gif" border="0"></td>
                        <td class="txtcolor"></td>
                      </tr>
                    
                      <tr>
                        <td background="jhd/legend.gif"
                            colspan="2" height="1"></td>
                      </tr>
                      <%next%>
                      <%else
                       for i=1 to 6%>
                        <tr>
                        <td class="txtcolor" align="middle" width="14"
                            height="26"><img src="jhd/left.gif" border="0"></td>
                        <td><a href="view_info.asp?id=<%=rs("id")%>" target="_blank" class="txtcolor">
                     <%  If Len(rs("title"))>20 Then
                Response.Write Leftb(rs("title"),20) & "…"
            Else
                Response.Write rs("title")
            End If%>
                      </a></td>
                      </tr>
                    
                      <tr>
                        <td background="jhd/legend.gif"
                            colspan="2" height="1"></td>
                      </tr>

                      <%rs.movenext%>
                      <%next
                      end if
                      %>
                    </tbody>
                </table>
              </tr>
            </tbody>
          </table></td>
    </tr>
  </tbody>
</table>
#4
letla2007-12-27 09:35
谢谢楼上两位的思路。。。
以下代码是我根据两位的思路写出来的。。。
请多多指教。。。
因为我的表格有牵涉到分页。。。
所以多加了个记录数求30的余数。。。
并且判断是否最后一页。。。
<%
yushu = rs.recordcount mod 30'记录数求30的余数
if nowpage=tatalpages then'判断是否最后一页
for j=1 to 30-yushu
%>
 <tr>
  <td> </td>
 </tr>
<%rs.movenext%>
<%next
end if%>
1