複数の画像を表示したい場合は、以下に示すようHtml.ActionLink
にプロパティを使用できます。View
このサンプルでは、[アクション] 列の下のボタンとして、画像の詳細/編集/削除を使用します。
注:と入力しTitle
、プロジェクトに応じController
てAction
名前を付けHtml.ActionLink
ます。空のタイトルを使用したい場合は、単純に「 」と入力してください。
....
//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>
完全な例については、次を参照してください: cshtml ビューで WebGrid を使用する方法は?
よろしく。