Click here to Skip to main content
15,890,512 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,
I need some help in displaying Images in grid style using Asp.net MVC razor.

The result i am getting is :- http://prntscr.com/byyv9b

How i want to display the image is :- http://prntscr.com/byyvl5

Any suggestion regarding the issue will be greatly appreciated.Thanks

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";

}


@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" />

Posted
Updated 1-Aug-16 1:30am
Comments
F-ES Sitecore 29-Jul-16 5:27am    
This is more of a design question TBH, you need to understand divs and floating divs etc, it's not really a coding question. Google how to format elements with divs and you'll probably find some tutorials, it's quite a big subject.

Hi,

CSS
Fltimg {
    float: left;
}


Set this class to images which you want to show side by side.
 
Share this answer
 
Comments
Kasar_7 30-Jul-16 2:38am    
Hi,
I've implement your method but still it doesn't work.Here's the code
<img id="@item.Img_id" class="floating" src="@Url.Content(@item.Img_data1)" data-zoom-image="@Url.Content(@item.Img_data1)" style="width:450px;height:300px" />
Ever heard of using jQuery plugins for such kind of work?

Well there are plenty of plugins available to show your bunch of images as tiles.

One of the good plugin is available on the following link.

Freewall

You may use the above mentioned plugin or can google for the related ones.

Hope it helps.
:)
 
Share this answer
 
Comments
Kasar_7 2-Aug-16 2:31am    
Thank you
VICK 2-Aug-16 5:48am    
Pleasure. :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900