Solved

ASP DO WHILE

Posted on 2004-08-17
16
218 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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:Kiran Paul VJ
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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:
Kiran Paul VJ 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:Kiran Paul VJ
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:Kiran Paul VJ
ID: 12409872
hi JohnnyC,

thanx for the points, glad to know it helped.

kiranvj
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
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 tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…

726 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