Solved

ASP DO WHILE

Posted on 2004-08-17
16
214 Views
Last Modified: 2012-05-05
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
0
Comment
Question by:johnnyc313
  • 7
  • 4
  • 4
16 Comments
 
LVL 3

Expert Comment

by:mattfairw
ID: 11819722
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
 
LVL 16

Expert Comment

by:kiranvj
ID: 11819849
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
 
LVL 1

Author Comment

by:johnnyc313
ID: 11820500
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
 
LVL 3

Expert Comment

by:mattfairw
ID: 11820534
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
 
LVL 3

Expert Comment

by:mattfairw
ID: 11820580
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
 
LVL 3

Expert Comment

by:mattfairw
ID: 11820600
and by the way, that is a very nice looking web site :)
0
 
LVL 1

Author Comment

by:johnnyc313
ID: 11820647
hehehehe

Thanks very much.

and thanks for your help.


JohnnyC
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 1

Author Comment

by:johnnyc313
ID: 11820920
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
 
LVL 3

Expert Comment

by:mattfairw
ID: 11821264
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
 
LVL 3

Expert Comment

by:mattfairw
ID: 11821285
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
 
LVL 3

Expert Comment

by:mattfairw
ID: 11823997
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
 
LVL 16

Accepted Solution

by:
kiranvj earned 50 total points
ID: 11827724
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
 
LVL 16

Expert Comment

by:kiranvj
ID: 12409355
hi pinaldave,

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

kiranvj
0
 
LVL 1

Author Comment

by:johnnyc313
ID: 12409668
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
 
LVL 16

Expert Comment

by:kiranvj
ID: 12409872
hi JohnnyC,

thanx for the points, glad to know it helped.

kiranvj
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Problem to be resolved in this article Currently, development of website and web application can be done without writing thousands of lines of programming code by hand. Description This can be done through by using a open source framework such …
Accessibility and Usability are two concepts that seem to be closely related.  But, too many people seem to have a distorted perception of them. During last five years, those two words have come to the day-to-day work of almost every web develope…
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
This video teaches users how to migrate an existing Wordpress website to a new domain.

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now