【发布时间】:2017-08-24 20:52:36
【问题描述】:
我已经创建了一个 cshtml 文件。当我在 Visual Studio 中运行/构建解决方案时,解决方案构建得很好,甚至功能方面(据我所知)一切似乎都在工作,但我在 Visual Studio 错误窗口中看到了一些错误。有人可以指导我为什么会看到这些错误。
@if (Utils.IsCC)
{
<div class="CC">
<div class="form">
@Html.LabelFor(model => model.CreditDetails.CreditCard, htmlAttributes: new { @class = "control-label col-md-2 required" })
// Red squiggly comes in the entire line above
</div>
</div>
}
错误:
方法'System.Web.Mvc.Html.LabelExtensions.LabelFor(System.Web.Mvc.HtmlHelper, System.Linq.Expressions.Expression>,System.Collections.Generic.IDictionary)' 不能从用法中推断出来。尝试明确指定类型参数。
【问题讨论】:
标签: c# asp.net razor asp.net-mvc-5 html-helper