Click here to Skip to main content
15,897,187 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have a repeater control. I am trying to set Eval as image source but my code is not working. here it is
HTML
<img src='<%#"uploads/team/" + Eval("Image")%>' />

Where uploads/team/ is the image location and Eval("Image") contains the image name.

Any suggestions what is the issue with the code?
Posted
Updated 9-Jan-12 20:11pm
v2

Got it. You missed the string conversion on the Eval method. Rectified code is:

HTML
<img src="<%#"uploads/team/" + Eval("Image").ToString()%>" />
 
Share this answer
 
Rectified Code
HTML
<img src='<%#"uploads/team/" + Eval("Image").ToString()%>' />

or this
HTML
<img src='<%# Eval("Image","uploads/team/{0}") %>'>

</img>
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900