开发者

UnobtrusiveJavaScriptEnabled Spark View Engine

Does the UnobtrusiveJavaScriptEnabled feature of MVC3 work with other view engines beside Razor. I would assume so but all examples I have seen are for Razor

I am currently using the Spark view engine. I have set in my web.conf appSettings..

<add key="ClientValidationEnabled" value="true"/>
<add key="UnobtrusiveJavaScriptEnabled" value="true"/>

I have added reference for dataannotations to the pages/namespaces section of Spark configuration

<add namespace="System.ComponentModel.DataAnnotations"/>

I h开发者_如何学Cave included datannotations validation attributes on my model and tried to create a textbox

e.g Html.TextBoxFor(m => m.name); in my view.

However the inputbox has no addition attributes. output is.

<input type="text" value="" name="name" id="name">

If I can get this working I assume the dataannotation extensions should also work.


I can't see any reason why unobtrusive javascript validation wouldn't work with other engines such as Spark (but cannot say for sure as myself I've never used it). Make sure you have placed this textbox inside a form generated with the Html.BeginForm helper.


I think those configuration controls how the html is rendered, so it should not matter which view engine you choose to use.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜