我想用我刚下载的图标替换这三个字段编辑/细节/删除。这些图标大小为512x512,这会是一个问题吗?我可以在代码中调整它们的大小(如何),或者我应该使用某个程序调整它们的大小。 我一直在寻找网络,我发现了一些非常长的C#代码片段,但我不知道在哪里放置它以便用图标替换那些属性的文本。MVC替换编辑/详细信息/删除图标
这里是我的HTML:
@using PagedList.Mvc;
@model PagedList.IPagedList<Rating_System.Models.tblTeacher>
<link href="~/Content/PagedList.css" rel="stylesheet" type="text/css" />
@{
ViewBag.Title = "Teachers List";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<h2>Teachers</h2>
<p>
@Html.ActionLink("Add new", "Create")
</p>
@using (Html.BeginForm("Index", "Teachers", FormMethod.Get))
{
<p>
Търсене: @Html.TextBox("SearchString", ViewBag.CurrentFilter as string)
<input type="submit" value="Search" />
</p>
}
<table class="table">
<tr>
<th>
</th>
<th>
@Html.DisplayNameFor(model => model.First().FirstName)
</th>
<th>
@Html.DisplayNameFor(model => model.First().SecondName)
</th>
<th>
@Html.DisplayNameFor(model => model.First().Title)
</th>
<th></th>
</tr>
@foreach (var item in Model)
{
<tr>
<td>
<img src="@Url.Action("GetImage", "Teachers", new {item.ID})" width="45" height="45" />
</td>
<td>
@Html.DisplayFor(modelItem => item.FirstName)
</td>
<td>
@Html.DisplayFor(modelItem => item.SecondName)
</td>
<td>
@Html.DisplayFor(modelItem => item.Title)
</td>
<td>
@Html.ActionLink("Редактирай", "Edit", new { id = item.ID }) |
@Html.ActionLink("Детайли", "Details", new { id = item.ID }) |
@Html.ActionLink("Изтрий", "Delete", new { id = item.ID })
</td>
</tr>
}
</table>
@Html.PagedListPager(Model, page => Url.Action("Index", new { page, pageSize = Model.PageSize }))
Results @Model.FirstItemOnPage - @Model.LastItemOnPage от общо @Model.TotalItemCount Teachers
用''更改'@ Html.ActionLink(“Редактирай”,“Edit”,new {id = item.ID})'或者创建一个自定义HTML助手来渲染图像。应通过设置宽度和高度属性来调整所有提供的图像的大小。 –