开发者

Spark view engine and ASP.NET MVC 2 strongly Typed Html Helpers

开发者 https://www.devze.com 2022-12-31 08:57 出处:网络
I try to use HtmlHelper.TextBoxFor with spark view engine but view crashed with exception \"Dynamic view compilation failed.\'System.Web.Mvc.HtmlHelper\' does not contain a definition for \'TextBoxFor

I try to use HtmlHelper.TextBoxFor with spark view engine but view crashed with exception "Dynamic view compilation failed. 'System.Web.Mvc.HtmlHelper' does not contain a definition for 'TextBoxFor' and no extension method 'TextBoxFor' accepting a first argument of type 'System.Web.Mvc.HtmlHelper' could be found (are you missing a using directive or an assembly re开发者_运维问答ference?)".

It is my _global.spark:

<use namespace="System"/>
<use namespace="System.Linq"/>
<use namespace="System.Text" />
<use namespace="System.Web.Mvc"/>
<use namespace="System.Web.Mvc.Html"/>
<use namespace="System.Web.Routing"/>
<use namespace="System.Linq.Expressions" />
<use namespace="MyModels" />

In spark-view using: ${Html.TextBoxFor(m => m.UserName)}


I use the newest version of spark. I found what was wrong. I miss to add model type in view.

<viewdata model=MyModel"/>
0

精彩评论

暂无评论...
验证码 换一张
取 消