locked
How to close pop up page RRS feed

  • Question

  • i am opening a pop up using

    javascript:OpenPopUpPage(xyz.aspx)  in Sharepoint 2010

    how to close this pop up?? programatically

    Monday, October 22, 2012 6:02 AM

Answers

  • Hello,

    If you want to close it on some button click  you can add this to your buttons client click event:

    OnClientClick="window.frameElement.commitPopup();"

    You can use commitPopup function on any other client side event

    If you want to call it from code behind you can use ClientScriptManager.RegisterClientScriptBlock (http://msdn.microsoft.com/en-us/library/btf44dc9.aspx) to register your javascript to execute commitPopup on page load.(it could be simpler just to redirect user to the same page)

    Hope this helps.


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    • Proposed as answer by Bjoern H Rapp Monday, October 22, 2012 11:53 AM
    • Marked as answer by Emir Liu Friday, November 2, 2012 6:55 AM
    Monday, October 22, 2012 10:41 AM
  • Please refer the below link to open and close the popup,

    http://sharepointerz.blogspot.in/2012/04/sharepoint-modal-dialog.html


    Hiren Patel | Please click "Propose As Answer" if this post solves your problem or "Vote As Helpful" if this post has been useful to you.

    • Proposed as answer by Bjoern H Rapp Monday, October 22, 2012 11:53 AM
    • Marked as answer by Emir Liu Friday, November 2, 2012 6:55 AM
    Monday, October 22, 2012 10:53 AM

All replies

  • Hello,

    If you want to close it on some button click  you can add this to your buttons client click event:

    OnClientClick="window.frameElement.commitPopup();"

    You can use commitPopup function on any other client side event

    If you want to call it from code behind you can use ClientScriptManager.RegisterClientScriptBlock (http://msdn.microsoft.com/en-us/library/btf44dc9.aspx) to register your javascript to execute commitPopup on page load.(it could be simpler just to redirect user to the same page)

    Hope this helps.


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    • Proposed as answer by Bjoern H Rapp Monday, October 22, 2012 11:53 AM
    • Marked as answer by Emir Liu Friday, November 2, 2012 6:55 AM
    Monday, October 22, 2012 10:41 AM
  • Please refer the below link to open and close the popup,

    http://sharepointerz.blogspot.in/2012/04/sharepoint-modal-dialog.html


    Hiren Patel | Please click "Propose As Answer" if this post solves your problem or "Vote As Helpful" if this post has been useful to you.

    • Proposed as answer by Bjoern H Rapp Monday, October 22, 2012 11:53 AM
    • Marked as answer by Emir Liu Friday, November 2, 2012 6:55 AM
    Monday, October 22, 2012 10:53 AM