开发者

Asp.net MVC 2, spark engine and strongly Typed Html Helpers

Will I get the advantage of the new Strong开发者_如何学Pythonly Typed Html Helpers with asp.net MVC 2 if were to use the spark engine for rendering?


You can use any HtmlHelper that ship with the MVC framework in Spark view engine.

${Html.TextBoxFor(p => p.Name)}


Spark view page base class doesn't have public property Html with HtmlHelper type but u can add it yourself.

Add <var Html="new HtmlHelper<YourModel>(base.ViewContext, this)"/> on your spark view and after that u can use ${ Html.LabelFor(model => model.UserName)} as well as ${Html.Label("some label")}.


Whenever you are confused about it, you can't definitely know how to do, you still use aspx-like expression - <%statement%> :) Inline code in Spark supports #statement variation too.

Source: Spark expressions

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜