1

      <%foreach (Art a in SearchedArt)%>
			<%{ %>
				<tr>
					<td><asp:Image ID="Image1" runat="server" src=<%a.PicturePath %>/></td>
					<td><%= Global.Users.Find(m => m.UserID == a.UserID).Name %></td>
					<td>
						<ul>
							<%foreach (string tag in a.Tags) %>
							<%{ %>
								<li><%= tag %></li>
							<%} %>
						</ul>
					</td>
				</tr>
			<%} %>

So what I am trying to do is display a different image for each piece of art in a table. However, src=<%a.PicturePath%> doesn't seem to be doing the trick (I tried it with quotations and it didn't work either). How do I do this?

2
  • Aren't you missing an equal sign inside? src="<%= a.PicturePath %>" Commented Aug 21, 2017 at 22:44
  • Oh yeah my original had the "=" Commented Aug 22, 2017 at 0:21

1 Answer 1

1

The asp:Image is a server-side tag - you need to set its ImageUrl property from code behind or use a client-side <img> and set its src attribute:

<img src="<% =a.PicturePath %>" />
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you it worked perfectly

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.