using DataBinder in <img>

  • Thread starter Thread starter sklett
  • Start date Start date
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
 
try using this instead

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

Should work. Hope this helps,

HD
 
Back
Top