在
Asp.net 5项目中,默认情况下我有一个名为_ValidationScriptsPartial.cshtml的文件,
<environment names="Development"> <script src="~/lib/jquery-validation/jquery.validate.js"></script> <script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js"></script> </environment> <environment names="Staging,Production"> <script src="//ajax.aspnetcdn.com/ajax/jquery.validation/1.11.1/jquery.validate.min.js" asp-fallback-src="~/lib/jquery-validation/jquery.validate.js" asp-fallback-test="window.jquery && window.jquery.validator"> </script> <script src="//ajax.aspnetcdn.com/ajax/mvc/5.2.3/jquery.validate.unobtrusive.min.js" asp-fallback-src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js" asp-fallback-test="window.jquery && window.jquery.validator && window.jquery.validator.unobtrusive"> </script> </environment>
但是当我需要使用jquery验证时,我必须添加
<script src="~/lib/jquery-validation/jquery.validate.js"></script> <script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js"></script>
到_layout.cshtml的下面部分.
<environment names="Development"> <script src="~/lib/jquery/dist/jquery.js"></script> <script src="~/lib/bootstrap/dist/js/bootstrap.js"></script> <script src="~/lib/hammer.js/hammer.js"></script> <script src="~/lib/bootstrap-touch-carousel/dist/js/bootstrap-touch-carousel.js"> I HAVE TO ADD SCRIPT FOR JQUERY VARIDATION HERE </script> </environment>
那么_ValidationScriptsPartial.cshtml的目的是什么?
如何在项目中使用该文件?
请给我参考如何使用这个文件?