c# - 没有样式的 ASP Net MVC pagedlistpager
问题描述
我安装了 PagedList.Mvc 和 PagedList 但是当我使用它时我根本没有样式:
我的控制器看起来像这样:
public ActionResult CarrosList(string search, int? i)
{
return View(db.Carro.Where(x=>x.Estado != "Vendido" && x.Titulo.StartsWith(search) || search == null).ToList().ToPagedList(i ?? 1, 6));
}
我的 cshtml 页面如下所示:
@Html.PagedListPager(Model, i => Url.Action("CarrosList", new { i, search = Request.QueryString["search"]}))
解决方案
您显示的代码处理服务器端分页并呈现 HTML。
然而,样式都与 CSS 样式表有关。
来自https://github.com/TroyGoode/PagedList:
<!-- import the included stylesheet for some (very basic) default styling -->
<link href="/Content/PagedList.css" rel="stylesheet" type="text/css" />
基本上确保包含样式表。
明白了
仅当您首次添加 nuget 包时,才会安装 Content 文件夹中的内容。因此,如果其他人安装了该软件包并且没有将相关的 CSS 文件添加到源代码管理中,则它可能会丢失。您可能需要删除并重新添加 nuget 包进行修复。
推荐阅读
- c# - Asp.net Core 多文件上传到数据库
- c# - 安装程序自定义操作 - 注册 COM dll - C#
- java - 为什么类可以用泛型方法实现两个接口?
- c - 如果输出缓冲区有数据,调用 bufferevent_free 后会做什么?
- c# - C# 单个 UDP 侦听器,多个发送者提供数据问题
- javascript - 将 React 计时器重置为初始 const 值
- exception - 从 Asp.Net Web API 检索自定义异常到 Postman
- javascript - JavaScript 中未定义按键
- environment-modules - 设置环境模块
- python - (python):在每个点之后拆分成一个新行,并将每行的每个第一个字母大写,同时保留点