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 7013871
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:26:50+00:00 2026-05-27T22:26:50+00:00

I have a view in which I am attempting to do an ajax call

  • 0

I have a view in which I am attempting to do an ajax call (using MVC Ajax support) and insert the returned partial view into a div on the page. As far as I can tell, what I’m doing is very by-the-book. But instead of an Ajax call and an updated div, I’m getting a full postback.

Here’s the relevant chunk of the view:

<fieldset>
<legend>Available Instructors</legend>

<p>
    @{ using (Ajax.BeginForm("InstructorSearch", "CourseSection", new AjaxOptions() { UpdateTargetId = "divSearchResult" })) 
       {

        @Html.Raw(" Search: ")
        <select id="SearchType" name="SearchType">
            <option value="Last" @( (ViewBag.SearchType == "Last") ? " selected" : "")>Last Name</option>
            <option value="First" @( (ViewBag.SearchType == "First") ? " selected" : "")>First Name</option>
        </select>
        @Html.Raw(" ")
        <input type="text" id="SearchText" name="SearchText" value="@( ViewBag.SearchText)" />
        @Html.Raw(" ")
        <input type="submit" id="Search" name="Search" value="Search" />
       }
    }
</p>

<div id="divSearchResult"></div>
</fieldset>

Here’s the method on the controller:

[HttpPost]       
public PartialViewResult InstructorSearch(string searchType, string searchText)
{
    var list = Services.InstructorService.ListInstructors(
        base.CurrentOrganizationId.Value,
        (searchType == "First") ? searchText : null,
        (searchType == "Last") ? searchText : null,
        0,
        Properties.Settings.Default.InstructorListPageSize
        );
    return PartialView(list);
}

I’ve checked, and I’m loading MicrosoftAjax.js and MicrosoftMvcAjax.js.

So I’m stumped. I know that I can do all this in jQuery quite easily, and I’ve done that elsewhere, but this is a situation where, for reasons not worth getting into, if this could be made to work it would be the simplest, cleanest, easiest-to-understand solution.

  • 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-05-27T22:26:50+00:00Added an answer on May 27, 2026 at 10:26 pm

    I’ve checked, and I’m loading MicrosoftAjax.js and MicrosoftMvcAjax.js.

    Those scripts are obsolete in ASP.NET MVC 3. You can completely remove them from your site. They are useless. They are included only for backwards compatibility if you were upgrading from previous versions in which case you must explicitly disable unobtrusive AJAX in your web.config:

    <!-- Remark: don't do this => only for demonstration purposes -->
    <add key="UnobtrusiveJavaScriptEnabled" value="false"/>
    

    In ASP.NET MVC 3, Ajax.* helpers use jQuery by default. So must reference the jquery.unobtrusive-ajax.js which is what makes Ajax.* helpers work:

    <script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.js")" type="text/javascript"></script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a partial view which is returned via an Ajax call with a
I have an AJAX link that currently loads a partial view into a div.
I have a WebView into which I'm loading the facebook sharer php page. This
I've just run into an issue when attempting to grab a custom View using
I have view on which I defined a custom tagName. I need to be
i have view controller which contains a button which show the image library ,if
I have a view which I would like to fill up the entire screen
I have a view which has two labels. When I swipe left I fill
I have a view which is composed of top, left and bottom headers and
I have a view which was working fine when I was joining my main

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.