Solved

Replace Image If Not Uploaded

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Dreamweaver - Spell check extension 4 489
Read More links 12 362
unable to connect to host / dreamweaver cs3 11 159
Adobe Photoshop CC 2015 action script help 2 225
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 …
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

792 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