DataList ImageUrl Syntax

G

Guest

Have you tried something like:

<asp:Image ID="Image1" runat="server" ImageUrl='<%#
DataBinder.Eval(Container.DataItem, "PIN") %>.jpg' />

If that doesn't work, you can actually make it into a method:


<asp:Image ID="Image1" runat="server" ImageUrl='<%# AddSuffix(
DataBinder.Eval(Container.DataItem, "PIN") ) %> ' />

protected string AddSuffix(object urlPart)
{
return (string)urlPart +".jpg";
}

Peter
 

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,982
Messages
2,570,190
Members
46,736
Latest member
zacharyharris

Latest Threads

Top