Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Using IIf with Server.Encode

Posted on 2000-03-12
4
Medium Priority
?
552 Views
Last Modified: 2008-02-20
I've got this line:
<TD BORDERCOLOR=#c0c0c0 width="645" ><font color="#000000" face="Verdana" size="1"><%=Server.HTMLEncode(rs.Fields("ProgTitle").Value)%></font></TD>

I need to add an IIf in there that says, "if the Value of the field is Null, then make it equal to " ", else make it equal to the Value."
0
Comment
Question by:EvanL
[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
  • 2
  • 2
4 Comments
 
LVL 4

Accepted Solution

by:
CoolAss earned 60 total points
ID: 2610711
Instead of:
<%=Server.HTMLEncode(rs.Fields("ProgTitle").Value)%>

Do this:

<%
if Len(rs.Fields("ProgTitle")) < 1 then
  Response.Write(" ")
else
  Response.Write(rs.Fields("ProgTitle"))
end if
%>

This could also go all on one line:

<%if Len(rs.Fields("ProgTitle")) < 1 then Response.Write(" ") else Response.Write(rs.Fields("ProgTitle")) end if%>



0
 
LVL 4

Expert Comment

by:CoolAss
ID: 2610712
BTW, if for some reason this data can be a zero length string, yet not be Null, use this:

<%if IsNull(rs.Fields("ProgTitle")) then Response.Write(" ") else Response.Write(rs.Fields("ProgTitle")) end if%>

But chances are, the first post is what you want.







0
 
LVL 1

Author Comment

by:EvanL
ID: 2611926
Thanks for the post.  I'll try this tonight when I get home from work and report findings back here.
0
 
LVL 1

Author Comment

by:EvanL
ID: 2638382
Sorry for the delay.  Had to go out-of-town unexpectedly.

This works great.  Thanks for the help.
0

Featured Post

Independent Software Vendors: 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

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

636 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