2016年1月17日 星期日

[Trouble shooting] Validation message not show on PartialView

 MVC    Validation    PartialView   





Introduction


When I tried to refactor some duplicate codes on View by using PartialView.
I encountered a problem that the ViewModel’s validation message could not be shown on PartialView.

 

Environment

l   Visual Studio 2015 Ent.
l   MVC5


▌How to solve it?



Include jquery.validate.js and jquery.validate.unobtrusive.js

The front-end validation uses jQuery.validate.unobtrusive.js to validate the Html5’s data-val-* attributes.

This problem can be solved by including

l   jquery.validate.js
l   jquery.validate.unobtrusive.js




Reference












沒有留言:

張貼留言