Shibly  Sadik

Shibly Sadik

  • NA
  • 167
  • 139.7k

How to display photo in mvc

Jun 4 2015 2:27 PM
I have uploaded photos successfully in  "Content/Student/Photo" folder of my project  but can't display them in Index view.
 
here is my short code:
 
Model:
 
public string FirstName { get; set; }

[Display(Name = "Upload Image")]
[NotMapped]
public HttpPostedFileBase Photo { get; set; } 
 
Index View(for display):
@Html.DisplayNameFor(model => model.FirstName)
@Html.DisplayNameFor(model => model.Photo)

@foreach (var item in Model)
{
@Html.DisplayFor(modelItem => item.FirstName)

@Html.DisplayFor(modelItem => item.Photo)
}
 
what changes should  be made in the Index view??
 
 

Answers (1)