M
mikeon
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?
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?