If you want to display multi images you can use Html.ActionLink
property in your View
as shown below. In this sample I use Detail/Edit/Delete images as a button under Action column.
Note: Type Title
, Controller
and Action
name in Html.ActionLink
according to your project. If you want to use empty title simply type " " for them.
....
//for using multiple Html.ActionLink in a column using Webgrid
grid.Column("Action", format: (item) =>
new HtmlString(
Html.ActionLink("Show Details", "Edit", "Admin", new
{
applicantId = item.ApplicantID,
title = "Detail",
@class = "icon-link",
style = "background-image: url('../../Content/icons/detail.png')"
}, null).ToString() +
Html.ActionLink("Edit Record", "Edit", "Admin", new
{
applicantId = item.ApplicantID,
title = "Edit",
@class = "icon-link",
style = "background-image: url('../../Content/icons/edit.png')"
}, null).ToString() +
Html.ActionLink("Delete Record", "Edit", "Admin", new
{
applicantId = item.ApplicantID,
title = "Delete",
@class = "icon-link",
style = "background-image: url('../../Content/icons/delete.png')"
}, null).ToString()
)
)
....
<style type="text/css">
a.icon-link {
background-color: transparent;
background-repeat: no-repeat;
background-position: 0px 0px;
border: none;
cursor: pointer;
width: 16px;
height: 16px;
margin-right: 8px;
vertical-align: middle;
}
</style>
For full example, you might look at here: How to use WebGrid in a cshtml view?
Regards.