Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Return Callback not Firing on Modal Close

$
0
0

I've done this elsewhere in SharePoint, and it has worked perfectly, but it is not working on an Application Page presented as a modal in Central Administration.

I have one modal that has a button, and the button brings up a second modal. The code for that is:

        function Add(webAppUri) {
            var targetUrl = "/_admin/CA/Add.aspx?WA=" + webAppUri + "&IsDlg=1";

            var options = {
                url: targetUrl,
                args: null,
                title: 'Add',
                dialogReturnCallback: dialogCallback,
            };
            
            SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', options);

            function dialogCallback(dialogResult, returnValue) {
                    __doPostBack('','');
                }
            }

And on the child modal, I have a standard ASP.NET button that has a server-side click function:

protected void btnOk_OnClick(object sender, EventArgs e)
{
// ... do stuff ...

            var context = HttpContext.Current;
            if (HttpContext.Current.Request.QueryString["IsDlg"] == null) return;
            context.Response.Write("<script type='text/javascript'>window.frameElement.commitPopup();</script>");
            context.Response.Flush();
            context.Response.End();
}

Now, this closes the child modal correctly, but on my parent modal, the function dialogResult is never fired. On close of the child modal (when the OK button is pressed), I need to refresh the parent modal.


Trevor Seward, MCC

Follow or contact me at...
&nbsp&nbsp

This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.


Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>