using DataBinder in <img>

S

sklett

Hi-

I am using an <img> tag in a DataList. Here is the code:
<img src='~/Images/<%# DataBinder.Eval(Container.DataItem, "Img")%>'
runat="server">

This results in:
" />


I don't understand what it is doing? This is strange to me. Am I doing
something wrong?

Thanks for any help!

Steve
 
H

Hermit Dave

try using this instead

<img src='<%# "~/Images/" + DataBinder.Eval(Container.DataItem, "Img") %>'
runat="server">

Should work. Hope this helps,

HD
 

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,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top