开发者

ASP.Net MVC3 - Can we apply custom client validation at the level of EditorTemplate

开发者 https://www.devze.com 2023-02-19 03:27 出处:网络
If one of the fields in the Model is bound to a EditorTemplate, will the javascript unobtrusive data-val-* parameters be generated for the EditorTemplate if the field in the Model is decorated with va

If one of the fields in the Model is bound to a EditorTemplate, will the javascript unobtrusive data-val-* parameters be generated for the EditorTemplate if the field in the Model is decorated with validation attributes.

Also, if I apply a custom client validation, by implementing a validation attribute with IClientValidatable, and decorate this field with that custom attribute, does it generate the data-val-* attributes for the EditorTemplate in the client side, for the client rules I add in the custom validaiton attribute?

I don't seem to get it working, it does not emit the client side attributes for me.

开发者_如何学编程

This is a simpler and part of my previous post


Got it working. Thanks to Brad Wilson on other forum, actually if we have any input control in it, for which a validation can be applied, it is generating data-val-* attributes. I was checking in some other scenario, it was not working for me, but a normal simple case is generating those attributes.

0

精彩评论

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