Html.TextBoxFor 提示出错解决办法

在.cshtml面面中

@Html.TextBoxFor(model => model.Name)

上面语句提示如下错误, 并且model属性不能智能提示

The type arguments for method 'System.Web.Mvc.Html.InputExtensions.TextBoxFor<TModel,TProperty>(System.Web.Mvc.HtmlHelper<TModel>, System.Linq.Expressions.Expression<System.Func<TModel,TProperty>>)' cannot be inferred from the usage. Try specifying the type arguments explicitly.

解法办法

在web.config上添加

<compilation debug="true" targetFramework="4.0"/>

 

posted @ 2012-12-20 12:14  Season2009  阅读(508)  评论(0编辑  收藏  举报