Solved

Replace Image If Not Uploaded

Posted on 2004-08-31
5
233 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: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 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Insert multiple row form with checkboxes 9 1,026
page loads much slower in IE than chrome 9 1,231
Expression Web 2 - where to go? 3 349
Regular Expressions find/replace needed 10 142
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 tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

816 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

8 Experts available now in Live!

Get 1:1 Help Now