Wrox Programmer Forums
|
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Dreamweaver (all versions) section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 2nd, 2004, 08:20 AM
Registered User
 
Join Date: Aug 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Empty record field, No image

This is a ASP.NET VB guestion.

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 am using Dreamweaver MX 2004, ASP.NET VB, Windows 2003 server, MsSQL database.

This is what I've come up with but it doesn't work, I've looked everwhere Experts Exchange, DMZ Zone, etc. and no one can help.

<if isEmpty(dsProperty("Image_01)Response.Write "No Image" Else Response.Write "<img src="../property/<%# dsProperty.FieldValue("Image_01", Container) %>">

 
Old September 2nd, 2004, 09:34 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
Default

You can create a image that reads 'no image' and send use it if the upload is blank. That way there will alwasy be an image file.

 
Old September 2nd, 2004, 09:51 AM
Registered User
 
Join Date: Aug 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by stu9820
 You can create a image that reads 'no image' and send use it if the upload is blank. That way there will alwasy be an image file.

I have tried that, but it will not display either the uploaded image or the no image gif, and to be safe I also tried it with <If isNulls(dsProperty("Image_01"))
Now the field is nchar, but I don't think that should have any effect on this.

Code from the page:

<If isEmpty(dsProperty(Image_01)) Response.Write "<img src="http://www.wdthost.com/property/00image.gif" Else Response.Write"<img src="http://www.wdthost.com/property/<%# dsProperty.FieldValue("Image_01", Container) %>">




 
Old September 2nd, 2004, 10:06 AM
Registered User
 
Join Date: Aug 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by dstubblefield
 
Quote:
quote:Originally posted by stu9820
Quote:
 You can create a image that reads 'no image' and send use it if the upload is blank. That way there will alwasy be an image file.

I have tried that, but it will not display either the uploaded image or the no image gif, and to be safe I also tried it with <If isNulls(dsProperty("Image_01"))
Now the field is nchar, but I don't think that should have any effect on this.

Code from the page:

<If isEmpty(dsProperty(Image_01)) Response.Write "<img src="http://www.wdthost.com/property/00image.gif" Else Response.Write"<img src="http://www.wdthost.com/property/<%# dsProperty.FieldValue("Image_01", Container) %>">

Sorry Code should be:

<If isEmpty(dsProperty(Image_01))Response.Write "<img src="http://www.wdthost.com/property/00image.gif%>" Else Response.Write"<img src="http://www.wdthost.com/property/<%# dsProperty.FieldValue("Image_01", Container) %>">




 
Old September 2nd, 2004, 12:56 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Code blocks need the be between <% and %> and Response.Write should have parenthesis like this:

Response.Write("Test message...")

 
Old September 2nd, 2004, 06:37 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

As stu9820 said it must be in <% %> tags, and I don't think you have to have the parenthesis, and also, to include quotes " in script, you need to double up like this:

Response.Write ("And I say, ""Hello World!""")

HTH,

Snib

<><
 
Old September 3rd, 2004, 01:05 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

AFAIK, for ASP.NET the parentheses are required.

But dstubblefield, isn't it much easier to use databinding in your code behind? Use an ASP:Image control and then bind the image to your data....

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Missing borders on a empty string field ProfGerdes Crystal Reports 1 March 15th, 2012 03:14 PM
passwords field gets empty on autopost.. vivek_inos ASP.NET 1.0 and 1.1 Professional 3 July 13th, 2006 05:58 AM
Copy previous field record if next field is null ecampos Access VBA 6 June 23rd, 2006 12:55 PM
The last empty record in table should not show alie VB Databases Basics 4 March 9th, 2006 07:38 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.