Solved

Replace Image If Not Uploaded

Posted on 2004-08-31
5
226 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
  • 2
5 Comments
 
LVL 23

Expert Comment

by:adilkhan
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:
adilkhan earned 250 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

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

Title # Comments Views Activity
breathing space around footer 13 255
Read More links 12 337
need to delete multiple folders from webserver 8 206
Dreamweaver rs SQL format question 4 100
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 …
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 video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

743 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

15 Experts available now in Live!

Get 1:1 Help Now