This question is locked. New answers and comments are not allowed.
Note - this is a problem AND solution to something that took me two days to resolve (but it does have a question for Telerik at the bottom).
The problem was that I was using MVC3 with Ajax.BeginForm and, when using jQuery to submit the form, my partial view returned from the Controller was always returning into a brand new webpage instead of being inserted into the existing div.
Note that using a normal form submit button rather than jQuery was fine. If the latter isn't even working for you then it's likely that you haven't included the jquery.unobtrusive-ajax.min.js library in your page or set the following key in your site web.config:
If the normal submit button does work then carry on reading....
The problem was that two includes to different jQuery libraries (1.5.1 from a manual include and 1.6.4 from an automatic Telerik include) broke the Ajax form submission. I had to stop Telerik including the 1.6.4 automatically using the line below and then change my manual include to be to the 1.6.4 version rather than 1.5.1 (as I assume that Telerik MVC needs the later version). I couldn't just remove the manual 1.5.1 include as then I got jQuery undefined errors as the Telerik includes were at the bottom of the _Layout.cshtml page (too late).
I changed:
to
The full details are over in my post on StackOverflow - StackOverflow question
Question for Telerik: Does the ScriptRegistrar call need to be at the bottom of the _Layout.cshtml page (or equivalent page)? or can it be at the top in the head which then might resolve the issue of the jQuery undefined problem and therefore having to change the manual include to 1.6.4.
Hopefully - this post might help someone with the same problem.
The problem was that I was using MVC3 with Ajax.BeginForm and, when using jQuery to submit the form, my partial view returned from the Controller was always returning into a brand new webpage instead of being inserted into the existing div.
Note that using a normal form submit button rather than jQuery was fine. If the latter isn't even working for you then it's likely that you haven't included the jquery.unobtrusive-ajax.min.js library in your page or set the following key in your site web.config:
<add key="UnobtrusiveJavaScriptEnabled" value="true" />If the normal submit button does work then carry on reading....
The problem was that two includes to different jQuery libraries (1.5.1 from a manual include and 1.6.4 from an automatic Telerik include) broke the Ajax form submission. I had to stop Telerik including the 1.6.4 automatically using the line below and then change my manual include to be to the 1.6.4 version rather than 1.5.1 (as I assume that Telerik MVC needs the later version). I couldn't just remove the manual 1.5.1 include as then I got jQuery undefined errors as the Telerik includes were at the bottom of the _Layout.cshtml page (too late).
I changed:
@Html.Telerik().ScriptRegistrar();to
@Html.Telerik().ScriptRegistrar().jQuery(false);The full details are over in my post on StackOverflow - StackOverflow question
Question for Telerik: Does the ScriptRegistrar call need to be at the bottom of the _Layout.cshtml page (or equivalent page)? or can it be at the top in the head which then might resolve the issue of the jQuery undefined problem and therefore having to change the manual include to 1.6.4.
Hopefully - this post might help someone with the same problem.