出于某种原因,在我的部分视图中,该卡未以正确的格式显示,卡的布局正确,但是它只是纯文本格式,因此该视图似乎缺少引导程序。在主视图和其他视图中,引导程序效果很好。 Bootstrap也包含在BundleConfig中。另外,我正在使用最新的引导程序4.4.1。
我的局部视图的代码是:
@model Testing.Models.Cars
<div class="card">
<h5 class="card-header">Header Title</h5>
<div class="card-body">
<h5 class="card-title">The title</h5>
<h5 class="card-title">A name</h5>
<div class="row">
@if (User.IsInRole("Admin"))
{
<div class="col-sm-4">
@Html.ActionLink("Edit", "Edit", new { id = Model.Id })
</div>
}
<div class="col-sm-4">
@Html.ActionLink("Details", "Details", new { id = Model.Id })
</div>
<div class="col-sm-4">
@Html.ActionLink("Delete", "Delete", new { id = Model.Id })
</div>
</div>
</div>
</div>
我认为代码是
@model PagedList.IPagedList<Testing.Models.Cars>
@using PagedList.Mvc;
<link href="~/Content/PagedList.css" rel="stylesheet" type="text/css" />
@{
ViewBag.Title = "Index";
}
<h2>Index View</h2>
@using (Html.BeginForm())
{
<p>
Find car by name: @Html.TextBox("SearchCar", ViewBag.CurrentFilter
as string)
<input type="submit" value="Search" />
</p>
}
<br />
<table class="table">
@foreach (var car in Model)
{
@Html.Partial("_PartialView", car)
}
</table>
<br />
Page @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber) of
@Model.PageCount
@Html.PagedListPager(Model, page => Url.Action("Index", new { currentFilter =
ViewBag.CurrentFilter }))