Reputation: 6973
I have a simple List view in MVC that renders some products. As soon as 1 product is selected I open a JQuery modal popup in this way:
function showDetails(id) {
hostId = id;
$("#detailDialog").load('/Product/Details/' + hostId);
$("#detailDialog").dialog("open");
}
The modal popup correctly loads the partial view with the details. As soon as I press submit in the view, the view returns the result (ActionResult) in a brand new page completely white with only the content of the view. How I can keep everything inside the popup? I need to do that because if the form has some invalid characters, I want to reshow in the popup the view with the validation errors.
Upvotes: 2
Views: 1084
Reputation: 85765
Your going to need to post more code. Like right now you just have the dialog box open. I don't see any of dialog buttons.So I am guessing your just put your own button that gets loaded from the ajax load?
So maybe if we see that code as well it might help as you say submit. Does that mean you have a button that does a submit request? If so that will make a full post back.
You either have to cancel the submit request by like putting "return false" at the end of it or change the submit button it a regular button and hook it up with a $.post();
This is just a simple example of blocking the submit call.
if you remove the return false it will load up the entire page again.
Upvotes: 1