?
Solved

Replace Image If Not Uploaded

Posted on 2004-08-31
5
Medium Priority
?
247 Views
Last Modified: 2010-04-07
I have been trying to find out ever where and can not find the answer, I have asked the same or similar question before but cant get a complete answer. When people add information to the website they have the option of uploading an image, if they don't upload an image we are stuck with that little x box.

I want to have it so if no image is uploaded that there is text saying "No Image Available" or "No Picture"

This is a ASP.NET Dreamweaver MX question, hosting on Windows 2003 server, database MsSQL

This is the code that I have on the page right now:

<img src="http://www.wdthost.com/property/<%# Thumbnail("Prefix","small_", dsProperty.FieldValue("Image_01", Container) ) %>" name="Image_01" id="Image_01"/>

This is what I think it might be, but it does not work:

<if isEmpty(dsProperty(Image_01)) Response.Write "No Image Available" else Response.Write "<img src="http://www.wdthost.com/property/<%# Thumbnail("Prefix","small_", dsProperty.FieldValue("Image_01", Container) ) %>" name="Image_01" id="Image_01"/>

I have been trying to get this figured out for a long time with out any luck.

Thanks
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
5 Comments
 
LVL 23

Expert Comment

by:Saqib Khan
ID: 11948869
isEmpty means the Variable Provided as Parameter in it has no Value Assigned to it.
Now in your Database how is the Value s Stored when no image is provided?

I assume You are storing Image names in Database.

if no Image is Provided and Column Defaults to a Null Value Then Try

if isNull(Img_Filed_Name)


OR try this

if Len(Img_Field) <= 0

OR

if Img_Filed = ""

You can also Put all of them together

if isNull(Field) OR Field = ""  OR Len(fld)  = ""

Again it depends how is your Databse Structured. if none of the above helped Then Post how you storing images in Databse.

0
 

Author Comment

by:ajstubblefield
ID: 11965105
Macromedia, sent me this as a alternative, but it will not work, below is the error.

<%
dim imgName = dsProperty.FieldValue("Image_01, Container")
If isEmpty(imgName) Then
  Response.Write "No Image"
Else
  Response.Write "<img src=http://www.wdthost.com/property/ + <%# Thumbnail("Prefix","small_", dsProperty.FieldValue("Image_01", Container) ) %>>" Endif %>


Server Error in '/' Application.

Microsoft (R) Visual Basic .NET Compiler version 7.10.3052.4
for Microsoft (R) .NET Framework version 1.1.4322.573
Copyright (C) Microsoft Corporation 1987-2002. All rights reserved.

E:\web\users\DED190STUN\html\spotRE\templateCpanel\TestImage.aspx(22) : error BC30455: Argument not specified for parameter 'Container' of 'Public Function FieldValue(FieldName As String, Container As System.Web.UI.Control) As String'.

dim imgName = dsProperty.FieldValue("Image_01, Container")
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
E:\web\users\DED190STUN\html\spotRE\templateCpanel\TestImage.aspx(23) : error BC30451: Name 'isEmpty' is not declared.

If isEmpty(imgName) Then
   ~~~~~~~              
E:\web\users\DED190STUN\html\spotRE\templateCpanel\TestImage.aspx(24) : error BC30800: Method arguments must be enclosed in parentheses.

  Response.Write "No Image"
                 ~~~~~~~~~~
E:\web\users\DED190STUN\html\spotRE\templateCpanel\TestImage.aspx(25) : error BC30081: 'If' must end with a matching 'End If'.

Else
~~~~
E:\web\users\DED190STUN\html\spotRE\templateCpanel\TestImage.aspx(26) : error BC30800: Method arguments must be enclosed in parentheses.

  Response.Write "<img src=http://www.wdthost.com/property/ + <%# Thumbnail("Prefix","small_", dsProperty.FieldValue("Image_01", Container) )
                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                                                
E:\web\users\DED190STUN\html\spotRE\templateCpanel\TestImage.aspx(26) : error BC32017: Comma, ')', or a valid expression continuation expected.

  Response.Write "<img src=http://www.wdthost.com/property/ + <%# Thumbnail("Prefix","small_", dsProperty.FieldValue("Image_01", Container) )
                                                                             ~~~~~~                                                          
0
 
LVL 23

Accepted Solution

by:
Saqib Khan earned 1000 total points
ID: 11969101
> If isEmpty(imgName) Then

Make Sure imgName is a Variable name, and has some value Set to it.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying 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

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…
I still run into .cgi files every now and then. In some instances, I actually prefer the simplicity of a .cgi script to other options. Since I use DreamWeaver extensively, what I needed was a way to open .cgi scripts in Dreamweaver. And I wanted to …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
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…
Suggested Courses

762 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