Other than the required "jquery" ScriptResourceDefinition
in Global.asax (use your own paths):
protected void Application_Start(object sender, EventArgs e)
{
ScriptManager.ScriptResourceMapping.AddDefinition(
"jquery",
new ScriptResourceDefinition
{
Path = "/static/scripts/jquery-1.8.3.min.js",
DebugPath = "/static/scripts/jquery-1.8.3.js",
CdnPath = "http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.3.min.js",
CdnDebugPath = "http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.3.js",
CdnSupportsSecureConnection = true,
LoadSuccessExpression = "jQuery"
});
}
You additionally only need to explicitly add "WebUIValidation.js" after "jquery" ScriptReference
in ScriptManager
(the most important part):
<asp:ScriptManager runat="server" EnableScriptGlobalization="True" EnableCdn="True">
<Scripts>
<asp:ScriptReference Name="jquery" />
<asp:ScriptReference Name="WebUIValidation.js" Assembly="System.Web" />
</Scripts>
</asp:ScriptManager>
If you add it before "jquery", or if you don't add any or both of them at all (ASP.Net
will then automatically add it before "jquery") - the client validation will be completely broken:
http://connect.microsoft.com/VisualStudio/feedback/details/748064/unobtrusive-validation-breaks-with-a-script-manager-on-the-page
You don't need any of those NuGet packages at all, nor any additional ScriptReference
(some of which are just duplicates, or even a completely unnecessary bloat - as they are added automatically by ASP.Net
if needed) mentioned in your blog.
EDIT: you don't need to explicitly add "WebForms.js" as well (removed it from the example) - and if you do, its LoadSuccessExpression
will be ignored for some reason