碰到的问题:
1,This type of page is not served.
修改View就碰到这个问题,解决办法就是add key="webpages:Enabled" value="true",修改Value值,从True到False,在从False到True。
2,View中自动提示@Model并不能引入model数据。不能用自动提示,手动写@model才行。
3,为了实现下标题,通过类扩展,为HTML增加方法PageLinks:
public static MvcHtmlString PageLinks(this HtmlHelper html, ?????????????????????????????????????????????PagingInfo pagingInfo, ?????????????????????????????????????????????Func<int, string> pageUrl) ???????{ ???????????StringBuilder result = new StringBuilder(); ???????????for (int i = 1; i <= pagingInfo.TotalPages; i++) ???????????{ ???????????????TagBuilder tag = new TagBuilder("a"); ???????????????tag.MergeAttribute("href", pageUrl(i)); ???????????????tag.InnerHtml = i.ToString(); ???????????????if (i == pagingInfo.CurrentPage) ???????????????{ ???????????????????tag.AddCssClass("selected"); ???????????????????tag.AddCssClass("btn-primary"); ???????????????} ???????????????tag.AddCssClass("btn btn-default"); ???????????????result.Append(tag.ToString()); ???????????} ???????????return MvcHtmlString.Create(result.ToString()); ???????}
关于Func<int, string>的介绍:
http://www.cnblogs.com/Gyoung/archive/2013/04/04/2997050.html
Asp.NET MVC5 学习历程(一)
原文地址:http://www.cnblogs.com/carl2846/p/7613572.html