Solved

ASP DO WHILE

Posted on 2004-08-17
16
217 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
DevOps Toolchain Recommendations

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

 
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
 
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Button to go back 3 28
CSS: Making Pure CSS read more boxes thinner 5 41
I am having a  Git   issue 6 41
website rewamp 5 42
FAQ pages provide a simple way for you to supply and for customers to find answers to the most common questions about your company. Here are six reasons why your company website should have a FAQ page
Color can increase conversions, create feelings of warmth or even incite people to get behind a cause. If you want your website to really impact site visitors, then it is vital to consider the impact color has on them.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

766 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