Implementation
The layout file (_Layout.cshtml
) defines the layout structure of your web application. As JavaScript libraries are going to be used in all the pages, this is the right place to add common functionalities such as unobtrusive validation.
Just add the JavaScript libraries (highlighted in bold in the following code snippet) to the layout file (_Layout.cshtml
) so that they will be available for all the View
files:
Note
Go to https://goo.gl/MKJ39B to access the code.
<!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width" /> <title>@ViewBag.Title</title> </head> <body> <div> @RenderBody() </div> <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-2.2.3.js"></script> <script src="https://ajax.aspnetcdn.com/ajax/jquery.validate/ 1.14.0/jquery.validate.min.js"> </script> <script src="https://ajax.aspnetcdn.com/ajax/mvc/5.2.3/jquery.validate.unobtrusive...