[thelist] ASP help

Michael Robertson mike at mikeemedia.com
Tue Sep 10 11:22:01 CDT 2002


Thank you for the tips, I will try that.

To answer your question about the exact nature of my problem: The table was
always appearing whether or not blnSub1 was True or False. The data inside
the table was working right, I was just not able to get rig of the empty
table when there was no data.

Thanks again

-------------------------------------------------------------------
----- Original Message -----
From: <David.Cantrell at Gunter.AF.mil>
To: <thelist at lists.evolt.org>
Sent: Tuesday, September 10, 2002 11:45 AM
Subject: RE: [thelist] ASP help


> >I'm trying to get these tables to write to a page only if the condition
is
> True. The information stored in varSub1 and
> >varSub2 are only dispalyed when True but the table itself always appears
> regardless of condition. Why is this and is there a >way around it. Thanks
>
> Maybe I don't quite understand your problem. I added the two blnSub and
> varSub variables and it worked just fine -- varSub1 was displayed when
> blnSub1 was true, and vice-versa.
>
> BTW much better to rewrite this code to be more modular -- right now
there's
> a lot of duplication.
>
> Also, without seeing the rest of your code, the variable names blnSub# and
> varSub# seem to be very generic names. You may want to consider renaming
> them as well?
>
> Try this code:  (watch for wrapping)
>
> <%
> blnSub1 = False
> blnSub2 = True
>
> varSub1 = 1
> varSub2 = 2
>
> If blnSub1 then
>   DisplayTip varSub1
> ElseIf blnSub2 then
>   DisplayTip varSub2
> End If
>
> Sub DisplayTip( s )
> 'Displays a tip table.
> 'Accepts: s. String to display.
>   With Response
>     .Write "<table border='0' cellspacing='1' cellpadding='4'
> style='background-color: #ccc; width: 150px;'>"
>       .Write "<tr>"
>         .Write "<td style='background-color: #56428b; font-size: 11px;
> font-weight: bold; color: white; text-align: center;'>Tip</td>"
>       .Write "</tr>"
>       .Write "<tr>"
>         .Write "<td style='background-color: #fff; font-size: 11px;
> font-weight: bold; color: #ff400; text-align: left;'>"
>           .Write s
>         .Write "</td>"
>       .Write "</tr>"
>     .Write "</table>"
>   End With
> End Sub
> %>
>
> The point is to encapsulate the "grunt-work" logic (the subroutine) and
keep
> your working logic at as high a level of abstraction as possible so the
code
> is more understandable and maintainable. Call it "at-a-glance" coding. :)
>
> HTH,
> -dave
> --
> For unsubscribe and other options, including
> the Tip Harvester and archive of thelist go to:
> http://lists.evolt.org Workers of the Web, evolt !
>
>





More information about the thelist mailing list