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

  • Home
  • SEARCH
  • 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 6941865
In Process

The Archive Base Latest Questions

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

I am trying to load an edit form which is a PartialView, into a

  • 0

I am trying to load an edit form which is a PartialView, into a div using jQuery. I am overloading the EditUser action. The 1st one is for passing the id and loading the form with existing details. The 2nd one is for posting back the form for save. But it seems to call the 2nd method when I load using jQuery and Url.Action. If I comment out the 2nd EditUser method, then it calls the 1st method. Why is that? How can I make it call the 1st one when I pass staffID? Or is there a better way to implement this Edit form in partial view scenario??

And the CreateUser action works just fine as there is no ambiguity on the overloaded methods as 1 has no parameters and the other has a model as parameter.

Thanks

This is my controller:

    public PartialViewResult EditUser(String staffId)
    {
        User um = userService.GetUserDetails(1, staffId, true);
        return PartialView(um);
    }

    [HttpPost]
    public PartialViewResult EditUser(User um)
    {
        if (!TryUpdateModel(um))
        {
            ViewBag.updateError = "Edit Failure";
            return PartialView("EditUser", um);
        }

        userService.CreateUpdateUser(um);
        return PartialView("ViewUser", um);
    }

    public PartialViewResult CreateUser()
    {
        ViewBag.Message = "Create New User";
        return PartialView(new User());
    }

    [HttpPost]
    public ActionResult CreateUser(User um)
    {

        if (!TryUpdateModel(um))
        {
            ViewBag.updateError = "Create Failure";
            return PartialView(um);
        }

        userService.CreateUpdateUser(um);
        return View("Index");
    }

This is how I am loading my EditUser partialview:

function menuEdit() {
    $('#ActionMenu').hide();
    $('#SearchBar').hide();
    $('#SearchPanel').hide();
    $('#SearchResult').hide();
    $('#AddViewEditUser').load("@Url.Action("EditUser","User")", {staffId : sId});
    $('#AddViewEditUser').show();
}
  • 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-27T12:56:27+00:00Added an answer on May 27, 2026 at 12:56 pm

    According to jQuery .load() “The POST method is used if data is provided as an object; otherwise, GET is assumed.” Since you are providing data, .load() is using the method “POST”, thus your second EditUser() is being called.

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

Sidebar

Related Questions

I am trying to load a form into a jquery dialog via ajax and
I'm trying to load a page that is basically an edit form inside a
I'm trying to load fragments of XHTML markup using jQuery's $.fn.load function, but it
Im trying to load a page I created using ajax, which loads fine and
I'm trying to edit a textbox's text in a Page_Load form on an ASP.NET
I'm trying to override FOSUserBundle form Edit profile ; I have created the class
I've been trying to show a GoogleMaps map, which is inside a fancybox div
Session expires frequently in extjs load() function. When i'm trying to load data into
I'm trying to load an html document into a WebBrowser control, but I'm at
I am trying to run an application with at least two threads: One form

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.