Solved

"image not provided" Dreamweaver 2004 MX, ASP.NET VB

Posted on 2004-08-21
6
162 Views
Last Modified: 2010-04-25
In making a file upload optional, when someone decides not to upload a file, is there a way to make the display page appear without that broken gif image? Maybe with words that say, "image not provided" - something like that....

I know in .asp the code is something like this, but I can't get anything to work in ASP.NET VB.

<% if myRecordset.Fields.Item("ImageFileName").Value <> "" then %>
<IMG SRC="/upload/<%=myRecordset.Fields.Item("ImageFileName").Value%>">
<% else ' no image %>
Image Not Provided
<% end if ' image check %>
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
6 Comments
 
LVL 8

Expert Comment

by:alexhogan
ID: 11862314
What you are saying with your statement;

<% if myRecordset.Fields.Item("ImageFileName").Value <> "" then %>

is that if your "ImageFileName" field is not empty then;

<IMG SRC="/upload/<%=myRecordset.Fields.Item("ImageFileName").Value%>">

display the image named in the database field "ImageFileName".

<% else ' no image %>
Image Not Provided
<% end if ' image check %>

else display the text "Image Not Provided".  However this is checking to see that the field is not empty.

Try changing your else condition to;

<% elseif  myRecordset.Fields.Item("ImageFileName").Value = "" then ' no image %>
or
<% elseif  myRecordset.Fields.Item("ImageFileName").Value = IsNull then ' no image %>

Image Not Provided
<% end if ' image check %>

or better yet give that field a default value of "no image" or something similar, and check for that value.

<% elseif  myRecordset.Fields.Item("ImageFileName").Value = "no image" then ' no image %>

0
 

Author Comment

by:ajstubblefield
ID: 11865741
I guess that I should have been clearer, this is for a ASP.NET VB site not .asp VB.

What I am looking for is, the user has the option of adding an image or not, if they decide not to add the image I would like to get rid of the nasty little x, and replace it with some text or a blank gif.

Here is what I came up with to replace with a gif:

<img src=”<If IsNull(dsProperty("Image_01")) then response.Write("http://otherdomain.com/property/no_image.gif") else Response.Write "http://wdthost.com/property/<%# dsProperty.FieldValue("Image_01", Container) %>">
0
 
LVL 8

Expert Comment

by:alexhogan
ID: 11866524
The code above is asp.net.

The problem with your statement above is that you are checking to see if the field is not empty and not checking for other conditions.

However, I'm glad that you found something that will work for you.
0
 
LVL 3

Expert Comment

by:swarnajyothirmayi123
ID: 11968883
since you are using asp.net you can use like this

<asp:Image runat="server" id="Image"/>
<asp:label runat="server" id="ImageNotFound" text="Image Not Found"/>

Sub Page_Load()
if not isPostBack then
'query the database and get the datatable.
'check if the database value is null
'if so then say
if IsNull("Image_01") then
Image.visible=false
ImageNotFound.Visible=true
Else
ImageNotFound.visible=false
Image.visible=true
Image.ImageURL="http://otherdomain.com/property/no_image.gif"
End if
End if
End Sub

or you can use

<asp:Image runat="server" id="Image"/>

Sub Page_Load()
if not isPostBack then
'query the database and get the datatable.
'check if the database value is null
'if so then say
if IsNull("Image_01") then
Image.ImageURL ="http://otherdomain.com/property/no_image.gif"
Else
Image.ImageURL=datatable.Rows(0).Item("Image_01")
End if
End if
End Sub
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 12268019
PAQed, with points refunded (500)

Computer101
E-E Admin
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

Suggested Solutions

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 …
Adobe Dreamweaver CS5 is a WYSIWYG web page editor that has advanced HTML, CSS, and Javascript rendering functionality and is probably the most well-known HTML editor available. Much of Dreamweaver's appeal centers around the Design View interfac…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

739 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