Html 部署后不显示操作链接上的MVC4映像
我正在使用CSS在Html 部署后不显示操作链接上的MVC4映像,html,css,asp.net-mvc,image,asp.net-mvc-4,Html,Css,Asp.net Mvc,Image,Asp.net Mvc 4,我正在使用CSS在@Html.ActionLink @model PagedList.IPagedList<WPSWorklog.Models.WorkList> @using PagedList.Mvc; @{ ViewBag.Title = "Work List"; } <h2>Work List</h2> @using (Html.BeginForm("Index", "WorkList", FormMethod.Get)) { &l
@Html.ActionLink
@model PagedList.IPagedList<WPSWorklog.Models.WorkList>
@using PagedList.Mvc;
@{
ViewBag.Title = "Work List";
}
<h2>Work List</h2>
@using (Html.BeginForm("Index", "WorkList", FormMethod.Get))
{
<table class="table-header1">
<tr>
<td>
@{
if(User.IsInRole("Admin"))
{
<!-- @Html.ActionLink("Create New", "Create") -->
<input type="button" value="New Record" onclick="location.href= './Worklist/Create' " />
}
}
</td>
<td style="width:80%;text-align:right">
Find by requester: @Html.TextBox("SearchString", ViewBag.CurrentFilter as string, new { style = "width: 100px; height: 15px" })
<input type="submit" value="Search" />
</td>
</tr>
</table>
}
<table id="data-list">
<tr>
<th class="ms-standardheader"></th>
<th class="ms-standardheader">
@Html.ActionLink("Requester", "Index",
new { sortOrder = ViewBag.RequesterSortParm })
</th>
<th class="ms-standardheader">
@Html.ActionLink("WPS", "Index",
new { sortOrder = ViewBag.PICSortParm })
</th>
<th class="ms-standardheader">
@Html.ActionLink("Doc # / Name", "Index",
new { sortOrder = ViewBag.DmDocNumberSortParm })
</th>
<th class="ms-standardheader">
@Html.ActionLink("Work Type", "Index",
new { sortOrder = ViewBag.WorkTypeSortParm })
</th>
<th class="ms-standardheader">
@Html.ActionLink("Submit", "Index",
new { sortOrder = ViewBag.SubmitDateTimeSortParm })
</th>
<th class="ms-standardheader">
@Html.ActionLink("Start", "Index",
new { sortOrder = ViewBag.StartDateTimeSortParm })
</th>
<th class="ms-standardheader">
@Html.ActionLink("Finish", "Index",
new { sortOrder = ViewBag.FinishDateTimeSortParm })
</th>
<th class="ms-standardheader">
@Html.ActionLink("Status", "Index",
new { sortOrder = ViewBag.WorkStateSortParm })
</th>
<th class="ms-standardheader">
@Html.ActionLink("Remark", "Index",
new { sortOrder = ViewBag.RemarkSortParm })
</th>
</tr>
@foreach (var item in Model) {
<tr>
<td>
<!-- Only Admin can edit or delete record -->
@{ if(User.IsInRole("Admin"))
{
@Html.ActionLink(" ", "Edit", new { id = item.WorkListID }, new { @class = "edit_link", title = "Edit" }) @Html.Raw(" ")
@Html.ActionLink(" ", "Delete", new { id = item.WorkListID }, new { @class = "delete_link", title = "Delete" })
}
}
<!-- other users can only see the detail -->
@Html.ActionLink(" ", "Details", new { id = item.WorkListID }, new { @class = "details_link", title = "View" })
</td>
<td style="text-align:center">
@Html.DisplayFor(modelItem => item.Requester.Initial)
</td>
<td style="text-align:center">
@Html.DisplayFor(modelItem => item.PIC.Initial)
</td>
<td>
@Html.DisplayFor(modelItem => item.DmDocNumber)
</td>
<td>
@Html.DisplayFor(modelItem => item.WorkType.Description)
</td>
<td>
@Html.DisplayFor(modelItem => item.SubmitDateTime)
</td>
<td>
@Html.DisplayFor(modelItem => item.StartDateTime)
</td>
<td>
@Html.DisplayFor(modelItem => item.FinishDateTime)
</td>
<td>
@Html.DisplayFor(modelItem => item.WorkState.Description)
</td>
<td>
<label title="@Html.DisplayFor(modelItem => item.Remark)" style="text-align:center"> ... </label>
</td>
</tr>
}
</table>
<br />
Page @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber) of @Model.PageCount (@Model.TotalItemCount record(s))
@Html.PagedListPager( Model, page => Url.Action("Index", new { page, sortOrder = ViewBag.CurrentSort, currentFilter = ViewBag.CurrentFilter }) )
问题是在我部署到生产环境后,图像没有显示。
我已经搜索并找到了这个链接
但是这个解决方案不适合我,因为它是在ActionLink中定义的,而不是在Site.css中定义的
更新:显示图标,但其位置不太整齐
我知道这个问题:通常我只是忘记将图像放入VS中的项目中。如果它不在VS中,它将不会被部署,但它会显示在我的开发服务器上,因为它在我的开发机器上可用。尝试在CSS中设置背景位置:
background-position: center center;
您可以使用这些值使其看起来正确。我在云部署中遇到了同样的问题。我就是这样解决的 遵循以下步骤:
检查您是否有正确的生产映像路径。此外,检查映像是否已上载到生产。@QuetiM.Porta映像已上载到生产“C:\inetpub\wwwroot\ApplicationName\Images”@OleksiiAza如果将代码更改为Html.ActionLink(“E”,“Edit”,new{id=item.EmployeeID},new{class=“Edit\u link”,我认为路径是正确的,title=“E”})显示的图像带有文本“E”,如果将display:inline table更改为display:block会怎么样?我添加了背景位置,显示仍然相同。仅供参考,我更新了整个网站。cssI没有忘记在VS中将图像放入项目中,它已经在那里了
background-position: center center;