Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

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

Posted on 2004-08-21
6
Medium Priority
?
175 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
5 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

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

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

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…
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…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
The Relationships Diagram is a good way to get an overall view of what a database is keeping track of. It is also where relationships are defined. A relationship specifies how two tables connect to each other. As you build tables in Microsoft Ac…
Suggested Courses

572 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