TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Jeroen Wetzels
NA
6
1.4k
Working with Images in ASP.Net MVC Framework
Aug 2 2012 9:41 AM
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.
Reply
Answers (
0
)
URL Routing using ASP.NET
performance tune 2010 web app