Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

Close Modal Wait Dialog After AsyncPostback

$
0
0

I have a button within a SharePoint Web Part that does a few things: first, it calls a JavaScript function which opens a wait screen modal dialog, it then does an asyncpostback to execute some server side code.  Since this is all done asynchronously, there is no full post back to close the loading modal dialog window and changing the design so it does a full post back breaks consistency within my other web parts so it is not an option.  Registering a client script within the post back method did not work when I tried it.  How can I get this dialog to close? Is there another way to show a loading screen in SharePoint besides the default SP.UI.ModalDialog.showWaitScreenWithoutClose method?  My code is below.

JavaScript:

function ShowLoadingModal() {
    	window.parent.eval('window.modalLoading = SP.UI.ModalDialog.showWaitScreenWithNoClose("Processing Action", "Please wait while the action is being processed.");');
    }

C#:

protected void btnReset_Click(object sender, EventArgs e) {
            (Session["TreeOperations"] as TreeOperations).Revert();

            btnReset.Enabled = false;
            btnPublish.Enabled = false;
            //binding a control for folder and file display
            DataBindPage(TreeNode.CreateTree(), new TreeOperations());
			ClientScriptManager scmCloseWait = Page.ClientScript;
			scmCloseWait.RegisterClientScriptBlock(this.GetType(), "modal_register", @"<script type='text/javascript'>if(window.frameElement != null) { if(window.parent.modalLoading != null) { window.parent.modalLoading.close(); } }</script>");
        }


Viewing all articles
Browse latest Browse all 11571

Trending Articles



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