Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Replace Image If Not Uploaded

Posted on 2004-08-31
5
Medium Priority
?
250 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

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…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

650 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