...

View Full Version : Not Displaying blank images



monfu
07-08-2004, 09:45 AM
Dear All

I have a problem when displaying images. I wish that when there is no image, ie the field in the database is blank, I do not display any image, since at the moment, it is like displaying a broken link with an x.

Presently, my code is like this:-

<tr class="bodytext">
<%
dim linkImage as string
dim Container As System.Web.UI.Control
linkImage = vwLinks.FieldValue("linkImage", Container)
if linkImage <> "" then
%>
<td>
<span class="image_right">
<img src="images/Links/<%# vwLinks.FieldValue("linkImage", Container) %>"></span>
<span class="bodytext">
<%# vwLinks.FieldValue("linkText", Container) %></span></td>
<%
end if
%>
</tr>

However this code :-
linkImage = vwLinks.FieldValue("linkImage", Container)
is not looping cause it needs the # infront

I tried to do it like this:-
linkImage = %> <%# vwLinks.FieldValue("linkImage", Container)%>
but it gave me a syntax error. How can I solve this?

Thanks for your help and time

johann

ecnarongi
07-08-2004, 02:46 PM
this is .Net right? Because if it isn't PHP programming has really warped my ASP knowledge. Why not just display a transparent.gif or nothing if the "if condition" fails? Or is that not your problem? Is your problem that you can not get the correct value for linkImage while still continuing to loop through the results?

fractalvibes
07-08-2004, 03:27 PM
Create a special "No Image Found" gif or jpeg - if you do not get any hits when querying for your image, display that instead..so put that in your container.

fv

monfu
07-08-2004, 03:56 PM
I already tried that. However the problem is that this piece of code:-

dim linkImage as string
dim Container As System.Web.UI.Control
linkImage = vwLinks.FieldValue("linkImage", Container)
if linkImage <> "" then

Will always grab the same image. I need to insert a "#" before the vwLinks.FieldValue("linkImage", Container) in some way

And yes it is .NET



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum