I have the following view definition in my asp.net mvc website:
<% Using Ajax.BeginForm("UsrCtlChangePassword", "User", Nothing, New AjaxOptions With {.UpdateTargetId = "resultDiv", .InsertionMode = InsertionMode.Replace, .HttpMethod = "Post"}, New With {.id = "myFormID"})%>
<%: Html.ValidationSummary(True, "Invalid details supplied.")%>
...View field definition in here
...
<% End Using%>
</div>
So basically when the user enters invalid information (old password doesn't match) the whole page isn't refreshed just the targetdiv.
This works perfectly in my dev environment. The problem I have is that I have now deployed it to my web host server (softsys windows 2008 server) and it doesn't work upon the deployed server. It totally ignores the ajax insertion mode logic and just sends back the entire form.
Why would it be working in dev and not on the deployment server? I've checked all the dlls and scripts and everything seems to be there. Following is the dll's in my bin folder:
I've got the following keys set in my web.config (I changed the UnobtrusiveJavaScriptEnabled to true and it didnt make a difference):
<add key="webpages:Version" value="1.0.0.0" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="false" />
And this is the script links in my site.master:
<link href="../../Content/Site.css" rel="stylesheet" type="text/css" />
<link href="<%: Url.Content("~/Content/themes/Redmond/jquery-ui.css")%>" rel="stylesheet" type="text/css" />
<script src="<%: Url.Content("~/Scripts/jquery-1.5.1.min.js") %>" type="text/javascript"></script>
<script src="<%: Url.Content("~/Scripts/modernizr-1.7.min.js") %>" type="text/javascript"></script>
<script src="<%: Url.Content("~/Scripts/jquery-ui-1.8.11.min.js") %>" type="text/javascript"></script>
<script src="<%: Url.Content("~/Scripts/jquery.cookie.js") %>" type="text/javascript"></script>
<script type="text/javascript" src="<%: Url.Content("~/Scripts/MicrosoftAjax.js") %>"></script>
<script type="text/javascript" src="<%: Url.Content("~/Scripts/MicrosoftMvcValidation.js") %>"></script>
<script type="text/javascript" src="<%: Url.Content("~/Scripts/MicrosoftMvcAjax.js") %>"></script>
Any ideas?
Thanks in advance.
I worked it out, it ended up being that I needed to add the following lines to my site.master:
<% Html.EnableClientValidation()%>
<% Html.EnableUnobtrusiveJavaScript(False)%>
For some reason the keys I set in the web.config were being ignored when deployed to the webserver. As soon as I added these lines to the site master everything worked as it should.