Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8563893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T17:04:25+00:00 2026-06-11T17:04:25+00:00

The Setup: I have updated an app from ASP.NET MVC 3 to ASP.NET MVC

  • 0

The Setup:

I have updated an app from ASP.NET MVC 3 to ASP.NET MVC 4.

The app worked fine in MVC 3. The only thing that isn’t working in MVC 4 is Ajax.Begin form: the form defaults to full page requests, instead of async AJAX requests.

Essentially, it is a wizard that I have written, but that is irrelevant. Model.Step.ActionName correctly returns a string (see code below).

The Code:

The code in the View is:

@{ 
    using (Ajax.BeginForm(Model.Step.ActionName, null, new AjaxOptions { UpdateTargetId = "wizardStep", OnBegin="isValid", LoadingElementId="PleaseWait", OnSuccess="SetFocusOnForm" }, 
        new {@name="wizardForm", @id="wizardForm" } ))
{

//form contents

}
}

The Rendering:

I note that Ajax.BeginForm in MVC 4 uses HTML 5. I show the difference between how MVC 3 and MVC 4 render the form below:

MVC 3:

<form action="/Solicitors/Company/New/YourDetails" id="wizardForm" method="post" name="wizardForm" onclick="Sys.Mvc.AsyncForm.handleClick(this, new Sys.UI.DomEvent(event));" onsubmit="Sys.Mvc.AsyncForm.handleSubmit(this, new Sys.UI.DomEvent(event), { insertionMode: Sys.Mvc.InsertionMode.replace, loadingElementId: 'PleaseWait', updateTargetId: 'wizardStep', onBegin: Function.createDelegate(this, isValid), onSuccess: Function.createDelegate(this, SetFocusOnForm) });">

// form contents

</form>

MVC 4:

<form action="/Solicitors/Company/New/LoginDetails" data-ajax="true" data-ajax-begin="isValid" data-ajax-loading="#PleaseWait" data-ajax-mode="replace" data-ajax-success="SetFocusOnForm" data-ajax-update="#wizardStep" id="wizardForm" method="post" name="wizardForm" novalidate="novalidate">

// form contents

</form>

I have no idea if this is correct, but assume it is.

The Problem:

The problem, however, is that Ajax isn’t used, just full page refreshes. So sumat is wrong…

The Question:

The question is: What is wrong?!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T17:04:26+00:00Added an answer on June 11, 2026 at 5:04 pm

    OK, I have solved this.

    In the MVC 3 app, I had commented out the following in the web.config:

    <appSettings>
        <add key="webpages:Version" value="1.0" />
        <!--<add key="ClientValidationEnabled" value="true" />
        <add key="UnobtrusiveJavaScriptEnabled" value="true" />-->
      </appSettings>
    

    This explains why asp.net mvc 3 was not rendering html 5.

    In the new mvc 4 app, the default setting has ClientValidationEnbled=true and UnobstrusiveJavaScriptEnabled=true, as follows:

    <appSettings>
        <add key="webpages:Version" value="2.0.0.0" />
        ...
        <add key="ClientValidationEnabled" value="true" />
        <add key="UnobtrusiveJavaScriptEnabled" value="true" />
      </appSettings>
    

    So my app needed the following javascript files to be included:

    <script src="@Url.Content("~/Scripts/jquery-1.7.1.min.js")" type="text/javascript"></script>
        <script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.min.js")" type="text/javascript"></script>
        <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
        <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
    

    And it needed the microsoft*.js files throwing away, ie:

    @*<script src="@Url.Content("~/Scripts/MicrosoftAjax.js")" type="text/javascript"></script>
        <script src="@Url.Content("~/Scripts/MicrosoftMvcAjax.js")" type="text/javascript"></script>
        <script src="@Url.Content("~/Scripts/MicrosoftMvcValidation.js")" type="text/javascript"></script>*@
    

    I figured this out after reading @Darin Dimitrov’s reply to the following question:

    Are MicrosoftAjax.js, MicrosoftMvcAjax.js and MicrosoftMvcValidation.js obsolete as of ASP.NET MVC 3?

    Many thanks to Darin. The answer is worth reading, to enlighten yourself as to the meaning of the two appSettings I had disabled.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have code that works in a .NET 3.5 app that isn't working when
We have an ASP.NET MVC 4 application that links to legacy native code. The
I have an ASP.NET Web Forms app that I am building and running against
I have setup a SenchaTouch/PhoneGap app that pulls information from an external XML feed.
I'm running my MVC 3 app (recently updated from 2) on IIS 7.5 (Win
I have a MySQL 5 database that is updated every 5 minutes from a
I have a scenario wherein my ASP.NET MVC 3 web application hosted in IIS
I have a WPF/MVVM (using MVVM-Light) app setup with a ComboBox that is inside
Setup: I have a COM DLL that calls a method inside a managed C#
I have setup airbrake in my app but it doesn't seem to log any

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.