Question

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

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top