Luis sa

Luis sa

  • 2k
  • 10
  • 3.9k

How to display Images in grid using MVC

Jul 29 2016 4:24 AM
I need some help in displaying Images in grid style using MVC razor.
Here's what i have tried:-
-- Controller--
public ActionResult Index()
return View(db.Img_data.ToList());
--Razor View--
@using firstmvc.Models
@model IEnumerable<firstmvc.Models.Img_data>
ViewBag.Title = "Index";
Layout = "~/Views/Shared/Adminmaster.cshtml";
<table class="table table-responsive">
@foreach (var item in Model)
<img id="@item.Img_id" src="@Url.Content(@item.Img_data1)" data-zoom-image="@Url.Content(@item.Img_data1)" style="width:450px;height:300px" />
 And the result of the code in browser is :-
How i want to display the image is :-

Brought to you by:

Answers (3)