1

如果要使用spark 引擎进行渲染,我会获得带有 asp.net MVC 2 的新的强类型 Html 助手的优势吗?

4

3 回答 3

6

您可以在 Spark 视图引擎中使用 MVC 框架附带的任何 HtmlHelper。

${Html.TextBoxFor(p => p.Name)}
于 2010-01-14T17:25:24.433 回答
2

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

于 2010-02-06T10:26:52.437 回答
1

每当您对此感到困惑时,您肯定不知道该怎么做,您仍然使用类似 aspx 的表达式 - <%statement%> :) Spark 中的内联代码也支持#statement 变体。

来源:Spark 表达式

于 2010-02-27T04:39:39.257 回答