How to alter the ImageURL via VB

Discussion in 'ASP .Net Web Controls' started by MikeD, Jan 23, 2004.

  1. MikeD

    MikeD Guest

    Hello,

    I'm trying to switch the picture displayed in an asp:image control based on
    info obtained from a datatable. If the table contains a value of true then I
    wish to display one image or else display the other. The code I have to
    perform the test is correct, but it doesn't switch the image url. Here's
    what I have so far...

    If CurrRows(0)(7).ToString = "True" Then
    Me.imgNew.ImageUrl = "images\new.gif"
    Else
    Me.imgNew.ImageUrl = "images\blank.gif"
    End If

    This is in VB. If I output the ImageURL as a string to a label it shows
    correctly, but dosn't change on the page. The whole lot is within a Repeater
    control if that makes a difference.

    I don't get any errors but then neither do I get the desired result.

    Any thoughts? Please?

    <M>ike
     
    MikeD, Jan 23, 2004
    #1
    1. Advertising

  2. MikeD

    Gerald Klein Guest

    I am not a vb person but isnt true a keyword in vb? Could expressing it as a
    literal be getting the wrong result?
    How is true expressed in the table?




    "MikeD" <mikedotdinnis@abraxashyphenukdotcom> wrote in message
    news:...
    > Hello,
    >
    > I'm trying to switch the picture displayed in an asp:image control based

    on
    > info obtained from a datatable. If the table contains a value of true then

    I
    > wish to display one image or else display the other. The code I have to
    > perform the test is correct, but it doesn't switch the image url. Here's
    > what I have so far...
    >
    > If CurrRows(0)(7).ToString = "True" Then
    > Me.imgNew.ImageUrl = "images\new.gif"
    > Else
    > Me.imgNew.ImageUrl = "images\blank.gif"
    > End If
    >
    > This is in VB. If I output the ImageURL as a string to a label it shows
    > correctly, but dosn't change on the page. The whole lot is within a

    Repeater
    > control if that makes a difference.
    >
    > I don't get any errors but then neither do I get the desired result.
    >
    > Any thoughts? Please?
    >
    > <M>ike
    >
    >
     
    Gerald Klein, Jan 23, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kersh

    Alter Rendered HTML for page

    Kersh, Jul 24, 2003, in forum: ASP .Net
    Replies:
    6
    Views:
    517
    John Saunders
    Aug 6, 2003
  2. eRic
    Replies:
    2
    Views:
    408
  3. Wee Bubba
    Replies:
    2
    Views:
    410
    Wee Bubba
    May 17, 2004
  4. Shanli RICHEZ
    Replies:
    7
    Views:
    477
    Scott Allen
    Nov 28, 2004
  5. -berlin.de
    Replies:
    0
    Views:
    161
    -berlin.de
    Jun 30, 2007
Loading...

Share This Page