Solved

Replace Null with default gif

Posted on 2004-08-15
4
241 Views
Last Modified: 2012-06-21
I have been trying to replace the Null field with a default image gif, to get rid of the little x, when there is no image to display, using Dreamweaver MX 2004, ASP.NET VB and MsSQL.

I have tried to use <img src=”<If IsNull(dsProperty("Image_01")) then response.Write("http://wdthost.com/property/no_image.gif") else Response.Write "http://wdthost.com/property/<%# dsProperty.FieldValue("Image_01", Container) %>"> and a few others with out any success.
0
Comment
Question by:ajstubblefield
  • 2
  • 2
4 Comments
 
LVL 9

Expert Comment

by:prifre
ID: 11805794
Hi,

I would use the FileSystemsObject and the FileExists function.

There are many description on the web on how to use "FileExists"
http://www.codeave.com/asp/code.asp?u_log=60
or
http://www.w3schools.com/asp/showfile.asp?filename=demo_fileexists

with a smile
/prifre
0
 
LVL 23

Expert Comment

by:adilkhan
ID: 11807173
You Should Do this within your SQL Statement.

Select isNull(IMG, 'image_path.gif') As IMG From Table_Name

IMG is the Colum Name in your Table.

Now when you print values on page it will replace automatically
0
 
LVL 23

Expert Comment

by:adilkhan
ID: 11807177
Also make sure dsProperty("Image_01"))  actualy Stored NULL values in DB, not Blank or Empty.

To play around test it with...

if isEmpty(dsProperty("Image_01"))  


OR

if dsProperty("Image_01") = ""
0
 
LVL 9

Accepted Solution

by:
prifre earned 250 total points
ID: 11876726
From the user...

"Hi, what I have is a real estate site, on the search page there are thumbnails that will take the user to a detail page that has up to 10 thumbnail on it. About 20% of the property listings have no Image or just a few. On the pages, if there is no image uploaded for that property I need to have a default gif or no_image.gif that will replace the little x that shows up or text that says no image provided.

Now I know that in Asp VB you can use this to replace and add text:

<% if myRecordset.Fields.Item("ImageFileName").Value <> "" then %>
<IMG SRC="/upload/<%=myRecordset.Fields.Item("ImageFileName").Value%>">
<% else ' no image %>
Image Not Provided
<% end if ' image check %>

But I can’t find any thing in ASP.NET VB to do the same.

Thanks"

Did not

if isEmpty(dsProperty("Image_01"))

as adilkhan suggested help?

with a smile
/prifre
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

For those who don't know, Adobe Dreamweaver is a popular commercial web editor that enables you to design, build and manage complex websites. The editor is a WYSIWYG (What You See Is What You Get) web editor, which means that you can create your web…
This article is very specific and is only intended to help if you are installing Dreamweaver 8 in a Windows 7 environment with Office 2007 installed.   I'm not sure why Microsoft tends to release OS' that should not be released but they do.  Windows…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

867 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

21 Experts available now in Live!

Get 1:1 Help Now