Solved

Replace Null with default gif

Posted on 2004-08-15
4
247 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:Saqib Khan
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:Saqib Khan
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

756 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