Hi,
I'm finding it difficult to pass in the id and the imageUrl values from a database into an image tag, as shown below
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<IEnumerable<RetailUploader.Website.Models.ViewModels.Images>>" %>
<p class="CreateButtonStyle">
<%= Html.ActionLink("Create New", "Create", null, new { @class = "createImage", title = "Create Image" })%>
</p>
<table>
<tr>
<th>
card Image
</th>
</tr>
<% foreach (var item in Model)
{ %>
<tr>
<td>
<img src="~/Uploads/" + <%: item.Id %> + "/" + <%: item.ImageUrl %> + "") alt="" />
</td>
</tr>
<% } %>
</table>
When the page renders, nothing displays apart from the table.
Is this the best way to render an image from a database?
Thanks,
Nick
Our community of experts have been thoroughly vetted for their expertise and industry experience.
The Fellow title is reserved for select members who demonstrate sustained contributions, industry leadership, and outstanding performance. We will announce the experts being inducted into the Experts Exchange Fellowship during the annual Expert Awards, but unlike other awards, Fellow is a lifelong status. This title may not be given every year if there are no obvious candidates.
The Most Valuable Expert award recognizes technology experts who passionately share their knowledge with the community, demonstrate the core values of this platform, and go the extra mile in all aspects of their contributions. This award is based off of nominations by EE users and experts. Multiple MVEs may be awarded each year.