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
精彩评论