I am using a partial view that is displayed in a pop up to edit the details of a record that is clicked on in the main window. On this view, the user can edit, delete or cancel. When the detail record is edited or deleted successfully, I want to close the partial view and update the main window. Right now, on delete, my main view is reloading in my pop up on success.
Any help getting this to work is greatly appreciated.
The HTML:
`<a href="javascript:popup('@Url.Action("EditCaseEmployer/" + item.Id, "CaseOptions")')">@item.StartDate.ToShortDateString()</a>`
Here are the custom javascript functions to popup a window:
function popup(url) {
window.open(url, 'notes', 'width=900,height=600,scrollbars=yes,resizable=yes,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0');
}
function popup(url, windowName) {
window.open(url, windowName, 'width=900,height=600,scrollbars=yes,resizable=yes,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0');
}
You could add a boolean property to the view model that you are using in your partial:
and then in the partial test its value and refresh the opener and close the popup:
Now all that’s left are the 2 controller actions that will be used to respectively show the partial and process it: