Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a web part from which I am popping up a aspx page that is used to upload a file. Code:

<a href="javascript:SP.UI.ModalDialog.OpenPopUpPage('/_layouts/MyProject/UploadFile.aspx');">

When I am done with my popup aspx page I would like to refresh a control on the original page (or the entire page) because there have been changes made that should be reflected. Is there a way to do this?

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

One way is to use the .parent property on your current object. Eg http://stackoverflow.com/questions/183702/access-parents-parent-from-javascript-object

Another way is by using jQuery as seen here http://stackoverflow.com/questions/726816/how-to-write-this-in-jquery-window-parent-document-getelementbyidparentprice

share|improve this answer
    
Ended up using window.parent.location.reload(true); in case anyone needs this. –  Abe Miessler Apr 28 '11 at 4:54
add comment

In your code behind, render this to close the popup

            Context.Response.Write("<script type='text/javascript'>window.frameElement.commitPopup();</script>");
            Context.Response.Flush();
            Context.Response.End();

And change your javascript link to refresh the page when the popup closes:

javascript:SP.UI.ModalDialog.showModalDialog({url:"{SiteUrl}/_layouts/",dialogReturnValueCallback: function(dialogResult, returnValue) { SP.UI.ModalDialog.RefreshPage(SP.UI.DialogResult.OK) }})
share|improve this answer
    
btw this is for modal popup, not a popup page, but you may be able to adapt it for your scenario –  djeeg Apr 16 '11 at 15:41
    
Can't seem to get it to work with a popup instead of a modal dialog –  Abe Miessler Apr 16 '11 at 15:46
add comment

Your Answer

 
discard

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.