ASP DO WHILE

Hi,

I have a "DO WHILE" Loop in my ASP page:

<% Do While Not rsExams.eof %>
    <tr>
         <td height="20" valign="middle" class="normaltext"><%= rsExams("examname")></td>
      <% IF rsExams("passed") = true Then %>
          <td width="62" valign="top"><img src="tick.jpg"></td>
      <% Else %>
          <td width="23" valign="top"><img src="cross.gif"></td>
      <% End If %>
   </tr>
<% rsExams.movenext()
             loop %>

It's working fine, but as more items are added to it the more it moves the page down, creating big gaps.  Is there anyway I can avoid this?

Thanks in advance...

JohnnyC
LVL 1
johnnyc313Asked:
Who is Participating?
 
Kiran Paul VJConnect With a Mentor Computer EngineerCommented:
hi, johnnyc313

found the solution to ur problem

this is ur code
<td widht ="  "  ..... >
<table width="100%" border="0" cellpadding="0" cellspacing="3" background="exambg.gif">

......this is the table in which exam details are show

</table>
</td>

now the correction to ur code is just add rowspan="3" in the < td > in the first line of above code
that is , the tag  will look like

<td .......  rowspan = "3" .......>

you can add width and height , but make sure to add rowspan = "3"

if u could not get it right , plz give the full asp code. i will correct it.

hope this helps

kiranvj
0
 
mattfairwCommented:
unless i'm missing something, i'm not quite sure what you mean by "big gaps". it appears that you have a one cell per row table with an image in each cell.  Do you mean you would like to page the database results due to a long list?
0
 
Kiran Paul VJComputer EngineerCommented:
hi..

i dont think there is any problem with the code.

can u please paste the full code.

may be some problem with other html tags

plz try this also

<td valign="top

<% Do While Not rsExams.eof %>
    <tr>
         <td height="20" valign="middle"       class="normaltext"><%= rsExams("examname")></td>
      <% IF rsExams("passed") = true Then %>
          <td width="62" valign="top"><img src="tick.jpg"></td>
      <% Else %>
          <td width="23" valign="top"><img src="cross.gif"></td>
      <% End If %>
   </tr>
<% rsExams.movenext()
            loop %>

</td>

it will be useful if u paste the code here

kiranvj
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
johnnyc313Author Commented:
If you look here:
http://www.magumba.co.uk/cemap/

and log in with username: john and password: john

On the right hand side there are a list of exams

But as I add more exams, the white gap on the left hand side gets bigger and bigger instead of remaining the same.

Thanks for your help,

Johnny C
0
 
mattfairwCommented:
ok, what you can do is ad a div and set the overflow property to "scroll" so that it will add a scroll bar and not change the height.
0
 
mattfairwCommented:
so for the right hane cell you have a <td> then you have your exam output table, followed by the closing </td>...so inbetween the <td> tags is where the <div> belongs

<td height="100%">
  <div width="100%" height="100%" style="overflow:auto">
      <table width="100%" border="0" cellpadding="0" cellspacing="0">
      <% Do While Not rsExams.eof %>
      <tr>
         <td height="20" valign="middle"       class="normaltext"><%= rsExams("examname")></td>
      <% IF rsExams("passed") = true Then %>
          <td width="62" valign="top"><img src="tick.jpg"></td>
      <% Else %>
          <td width="23" valign="top"><img src="cross.gif"></td>
      <% End If %>
     </tr>
     <% rsExams.movenext()
           loop %>
      </table>
  </div>
</td>
0
 
mattfairwCommented:
and by the way, that is a very nice looking web site :)
0
 
johnnyc313Author Commented:
hehehehe

Thanks very much.

and thanks for your help.


JohnnyC
0
 
johnnyc313Author Commented:
Hi again mattfairw,

That doesn't seem to have helped, I'm still having the same problem.

Does it matter that it is 2 tables side by side?  Like the main section is a table and the right hand side is another table?
0
 
mattfairwCommented:
no, it shouldn't. the div should be placed inside the table cell that is housed in the table that holds the right hand side.

so if you have a table that has 3 columns kinda like your website, you'd have:

<table>
  <tr>
    <td>content</td>
    <td>content</td>
    <td>
      <div style="overflow:auto">
        <table>
          <% Do While Not rsExams.eof %>
           <tr>
             <td height="20" valign="middle"       class="normaltext"><%= rsExams("examname")></td>
              <% IF rsExams("passed") = true Then %>
                 <td width="62" valign="top"><img src="tick.jpg"></td>
              <% Else %>
                 <td width="23" valign="top"><img src="cross.gif"></td>
              <% End If %>
           </tr>
          <% rsExams.movenext()
            loop %>
         </table>
       </div>
     </td>
  </tr>
</table>
0
 
mattfairwCommented:
not quite sure which two tables you mean are side by side, but it would be the same as in you'd have to have a nested table on the right side table.
0
 
mattfairwCommented:
ah! :) ok, now i remember what i did! i had the same problem to and the thing is you have to set a height to your div tag, else it will just expand the div tag for whats needed...so if you write your div tag like so:

<div style="overflow:auto; height:300px"> content</div>

That'll do the trick ;)

-Matt
0
 
Kiran Paul VJComputer EngineerCommented:
hi pinaldave,

i got the solution which i posted in my last post, i think the questioner did not check it

kiranvj
0
 
johnnyc313Author Commented:
Apologies for not returning to the question...Thanks for your help mattfairw, but it was kiranvj's suggestion that finally fixed it.

Thanks again for all your help...

JohnnyC
0
 
Kiran Paul VJComputer EngineerCommented:
hi JohnnyC,

thanx for the points, glad to know it helped.

kiranvj
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.