Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Apr 2003
    Location
    Malta
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Not Displaying blank images

    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

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    Northern NJ
    Posts
    404
    Thanks
    0
    Thanked 1 Time in 1 Post
    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?
    I would rather be a lion for a day than a lamb that lives forever.

  • #3
    Regular Coder
    Join Date
    Aug 2002
    Location
    Texas
    Posts
    287
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #4
    New to the CF scene
    Join Date
    Apr 2003
    Location
    Malta
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •