Databinding expression not evaluated - problem

Discussion in 'ASP .Net' started by mikeon@icpnet.pl, Sep 12, 2005.

  1. Guest

    Hello!

    I have an aspx page with 4 images on it:

    <img src="<%# ImageUrl %>" />
    <img src="x<%# ImageUrl %>" />
    <img src="<%# ImageUrl %>" runat="server" ID="Img1"/>
    <img src="x<%# ImageUrl %>" runat="server" ID="Img2"/>

    Assume that my code behind file has ImageUrl property defined and that
    I call DataBind() method when needed.

    I wonder if any of You would guess which one of the above images would
    have its src attribute set correctly?

    I thought that all of them, but I was wrong. It appears that what I get
    is:
    <img src="image.gif" />
    <img src="ximage.gif" />
    <img src="image.gif" id="Img1" />
    <img src="x<%# ImageUrl %>" id="Img2" />


    As You can see, the last expression is not evaluated.
    As You can see, the only difference is the use of runat="server"
    attribute (id attribute does not matter in this case).

    Can somebeody tell me why is it behaving in such a way?


    --
    Michal Talaga
    , Sep 12, 2005
    #1
    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. Jason Wright via .NET 247
    Replies:
    2
    Views:
    681
    Brian W
    Jun 12, 2004
  2. Dale
    Replies:
    2
    Views:
    4,134
  3. Replies:
    12
    Views:
    607
    Old Wolf
    Jul 12, 2006
  4. Replies:
    1
    Views:
    415
  5. Ben
    Replies:
    5
    Views:
    1,296
Loading...

Share This Page