Tech
Forums
Jobs
Books
Events
Videos
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
0
Answer
Working with Images in ASP.Net MVC Framework
Jeroen Wetzels
12y
1k
1
Reply
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.
Post
Reset
Cancel
Answers (
0
)
Next Recommended Forum
URL Routing using ASP.NET
performance tune 2010 web app