I've read a very usefull tutorial (
http://www.c-sharpcorner.com/uploadfile/dhananjaycoder/working-with-images-in-Asp-Net-mvc-framework/) on this site. But i've a question about it.
I use it for an MVC application and i would like to know the following:
I would like to use the code from the index.aspx file in an index.cshtml file.
The code in the index.aspx file =
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> <%
foreach (
var image
in ViewData.Model) { %>
<span class="image"> <a href="images/<%
= image.Path %>
"> <img src="images/<%
= image.Path %>
" height="100" width="100" /></a> <span class="description"><%
= image.Description %>
</span> </span> <% }%>
<p><%
= Html.ActionLink(
"Add your own image",
"Add",
"Image")%>
</p>
</asp:Content>
I created the following in the index.cshtml file
<ul>
@foreach (var image in ViewData.Model)
{
<span class="image">
<a href="Content/" + image.Path>
<img src="Content/" + image.Path height="100" width="100" /></a>
<span class="description"> image.Description</span>
</span>
}
</ul>
<p>@Html.ActionLink("Add your own image", "Add", "Image")</p>
but this doesn't work. How can i change it, so it works?
Thanks in advance.