sasha.marfut
sasha.marfut

Reputation: 25

Why PartialView is opening in new window with post action?

I have two action methods. Get method returns partialView with some form user have to fill.

Post method is calling when I push the button on this form, which returns a partial view too. but post method always opens partialview in the new window.

But I need post method to load partial view like PARTIAL, not in new window

Have you any ideas?

[HttpGet]
public PartialViewResult EditProfile(int freelancerId)

    FreelancerProfile freelancerProfile = new FreelancerProfile();

    return PartialView(freelancerProfile); // EditProfile is opening in the part of window. it's ok.
}

[HttpPost]
public PartialViewResult EditProfile(FreelancerProfile freelancerProfile)
{
    repository.SaveProfileChangesFreelancer(freelancerProfile);

    return PartialView("EditProfile", freelancerProfile); //EditProfile is opening in the new window. it's trouble
}

Upvotes: 0

Views: 1230

Answers (1)

CodeCaster
CodeCaster

Reputation: 151672

but post method always opens partialview in the new window.

That is not something your controller can do, it must be in the HTML calling your partial view.

Upvotes: 2

Related Questions