asp:image not visible when dynamic

D

Deere

When I try to take a database field and change it with a function and
return it...it will not display the image. The "Imageurl" does not
convert to "src=" but stays as ImageUrl.

id=Image2 will display ok ..and shows in view source as .......

<img id="gvwExample_ctl07_Image2"
src=".\images\toys\1_16\thumb\t_15511.jpg" style="border-width:0px;" />


id=Image3 will not display image and shows in view source as.......

<asp:Image id="Image3" ImageUrl=".\images\toys\1_16\thumb\t_15511.jpg"
runat="server" />

What am I doing wrong.....thanks



the "imageref": field below starts out as
".\images\toys\1_16\15511.jpg"
the function returns ".\images\toys\1_16\thumb\t_15511.jpg"

Code:

<asp:TemplateField HeaderText="Image">
<ItemTemplate>
<asp:Image id="Image2"
ImageUrl=".\images\toys\1_16\thumb\t_15511.jpg" runat="server" />
<asp:Image id="Image3"
ImageUrl="<%#testthis(Eval("imageref"))%>" runat="server" />
</ItemTemplate>
</asp:TemplateField>
 
M

Mark Fitzpatrick

Your slashes are in the wrong direction. They should be / instead of \

It could be that IE is able to translate it around, but ASP.Net could be
getting stuck as it will try to verify the path.

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage
 
D

Deere

Thanks for your response Mark but my test show the image will not
dispIay if the path slashes are / ... If you look at the the literal or
static path of Image2 which is / it will display. Its just the dynamic
return of the Image3 path that won't, even though it returns the same
path as the test static path of Image2

Any other thoughts would be appreciated.
 
D

Deere

Mark sorry I was wrong, the image will display no matter which way
the slashes are. I overwrote a letter when changing the slashes
eariler.
 
D

Deere

I got it to work by switching the double quotes to single on this
ImageUrl="<%#testthis(Eval("imageref"))%>" to
ImageUrl='<%#testthis(Eval("imageref"))%>'
not sure why as I had single quotes originally...sheesh programming
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,151
Latest member
JaclynMarl
Top