Solved

ASP DO WHILE

Posted on 2004-08-17
16
213 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
HTML table 7 54
Please explain "Promise Pattern" and how it's used 2 42
archiving old posts 9 25
Popup window in I.E. 8 38
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 …
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

762 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

17 Experts available now in Live!

Get 1:1 Help Now