Solved

Replace Null with default gif

Posted on 2004-08-15
4
248 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
[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 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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

Adobe Dreamweaver CS5 is a WYSIWYG web page editor that has advanced HTML, CSS, and Javascript rendering functionality and is probably the most well-known HTML editor available. Much of Dreamweaver's appeal centers around the Design View interfac…
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…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

738 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