0

私の .cshtml ファイルでは、@Html.TextBoxFor を使用する場所でエラーが発生します。

サンプルコードは次のとおりです。

@model WebComposite.Models.CompositeModel

<label for="name">Name</label>
@Html.TextBoxFor(m => m.name)

エラー:

Error #1:
'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.

Error #2: 
One or more types required to compile a dynamic expression cannot be found. Are you missing a reference?

何か案は?

4

1 に答える 1

0

他の誰かが疑問に思っている場合に備えて、これが私がそれを解決した方法です:

1. right click on the project -> select properties
2. select Application
3. change "target framework" (I was at 4.5, so I changed it to 4)
4. change "target framework" to whatever it was before step 3

web.config がクリーンアップされ、適切な参照が追加され、ビルドが実行され、すべてが正常に戻るはずです

于 2014-01-17T23:53:32.347 に答える