views:

534

answers:

3

Will I get the advantage of the new Strongly Typed Html Helpers with asp.net MVC 2 if were to use the spark engine for rendering?

+5  A: 

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

${Html.TextBoxFor(p => p.Name)}
Marwan Aouida
Spark version 1 did not support strongly typed helpers. But if you want to use mvc2, you got to use newest build of Spark anyway.
Arnis L.
+2  A: 

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")}.

avishnyakov
+1  A: 

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

tanza9