Solved

Replace Null with default gif

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

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…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

707 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

16 Experts available now in Live!

Get 1:1 Help Now