Reputation: 1230
Ok so I'm using MVC3 with razor and C#.
I have a common interface pattern that I'm using with modals.
If I'm on a form and there is a lookup field, I can click "Create" beside that lookup field. This pops up a jquery Modal dialog and displays the partial view for creating that item. I hit save it needs to close the modal and refresh the parent of that modal.
So if I have a modal already open and I open a new one from that one, I need it to reload the parent modal. I know how to do the reloads from jquery, my problem is figuring out when and where to do the callbacks with Ajax.ActionLink.
I saw "OnComplete" but how do I get that to be called? The submit button on the modals redirects to another page so how is it supposed to call the "OnComplete"
Upvotes: 0
Views: 379
Reputation: 16174
You could add some script to the dialog form that finds and closes the parent. However a better approach would be to use Ajax.Form instead of Html.BeginForm in your dialogs.
That way the submit button on the dialog will update only a specified area within the dialog and has an OnComplete handler that can close the dialog if required.
Upvotes: 1