SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In a webpart, I added a button that should trigger a modal dialog, and display a message when the dialog is closed.

The dialog script is handled by this code :

function OpenGenericForm(formUrl, confirmText) {
    ExecuteOrDelayUntilScriptLoaded(function () {
            url: formUrl,
            dialogReturnValueCallback: function (dialogResult, returnVlue) {
                if (dialogResult == SP.UI.DialogResult.OK) {
                    SP.UI.Notify.addNotification(confirmText, true);
    }, 'sp.js');

And the button is :

<a id="someid" onclick="OpenGenericForm('/Lists/gen test/NewForm.aspx','some message');return false;" href="#">label of the link</a>

The modal is opened as expected, but when it closes, I can see the notification a quarter of seconds, before the whole page is reloaded (and then my notification disappeared.

Isn't a call to RefreshPage(dialogResult) supposed to reload the page using some kind of ajax?

If not, what the correct way to reload content of webparts using ajax?

share|improve this question
Steve, any traction on this? It seems like an interesting question. I'll upvote it once I have more votes for the day. – Robert Kaucher Feb 28 '14 at 14:52
function portal_openModalDialogContact(URL) {
    var options = SP.UI.$create_DialogOptions();
    options.url = URL;
    options.width = 600;
    options.dialogReturnValueCallback = Function.createDelegate(null, CloseCallback);
function CloseCallback(result, target) {

    window.parent.location.href = window.location.href; //This will refresh your page after popup got closed

This will solve your problem

share|improve this answer

RefreshPage tells the browser to reload the whole page. You would need to use some functionality like in this post to reload update panels (if your webpart content is not in an update panel, it will reload the whole page regardless):

The example from the article uses:

<div id="Container" onclick="__doPostBack('UpdatePanel1', '');">
share|improve this answer
Actually, I don't need/want to refresh my webpart, but all webparts in the page, using their builtin refresh. but I think it won't be as easy. I may move my notify script to a postback handler – Steve B Mar 1 '13 at 16:34

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.