Modal Popup won't close

Last post 09-19-2009 5:35 PM by i3ny. 4 replies.

Sort Posts:

  • Modal Popup won't close

    09-17-2008, 10:45 PM
    • Member
      10 point Member
    • jgabriel
    • Member since 09-04-2008, 2:19 AM
    • Posts 27

    I have a modal popup and I have assign a button for CancelControlID. I aslo have another button that will do a proccess with data inputted in the popup my problem is once I click that button my cancel button stops working.

    Thanks

  • Re: Modal Popup won't close

    09-18-2008, 1:42 AM
    • Participant
      928 point Participant
    • prodipta.mondal
    • Member since 09-03-2008, 7:02 AM
    • Kolkata
    • Posts 167
    function WindowOperation()
    {

    if(window.showModalDialog)
    {
    window.showModalDialog('Hello.aspx?ID=1','Hello','width=500,height=500,status=no,toolbar=yes,location=no,resizable=no,menubar=no,top=10,left=10,ScreenX=10,ScreenY=10,modal=yes');
    }
    else
    {
    window.open('Hello.aspx?ID=1','Hello','width=500,height=500,status=no,toolbar=yes,location=no,resizable=no,menubar=no,top=10,left=10,ScreenX=10,ScreenY=10,modal=yes');
    }
    }

    use this javascript to open the modal popup and the following code at the Codebehind page of Hello.aspx (i.e. the modal window page) at Page_Load event.
    btnClose.Attributes.Add("onclick","window.close();");
    This should work.
    With Regards,
    Prodipta Mondal.


    Please remember to click “Mark as Answer” on the post that helps you. This can be beneficial to other community members reading the thread.
  • Re: Modal Popup won't close

    09-19-2008, 3:10 AM
    Answer

    Hi,

    Did the button proccessing generates JavaScript error so that the cancel button can't work?

    Or you can try to use JavaScript to handle the cancel button.

    1. Please don't set the cancel button as CancelControlID of ModalPopup.

    2. Set the ModalPopup Behavior ID to 'programmaticModalPopupBehavior', and Set the cancel button as:  <input id="Button1" type="button" value="Cancel" onclick="hidepopup()" /> .

     The below script can hide the panel.

           function hidepopup()
            {
                var modalPopupBehavior = $find('programmaticModalPopupBehavior');
                modalPopupBehavior.hide();
            }

    If it can't work either, please check if there is the client error on your browser.

     


    Vince Xu
    Microsoft Online Community Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
  • Re: Modal Popup won't close

    09-19-2008, 5:08 AM
    • Member
      10 point Member
    • jgabriel
    • Member since 09-04-2008, 2:19 AM
    • Posts 27
    Sorry but I haven't tried using javascript yet. The problem is once I click the other button and the popup updates cause of the update panel the cancel button doesn't work anymore. I'll try your suggestion using javascripts as soon as I can. Thanks for your reply.
  • Re: Modal Popup won't close

    09-19-2009, 5:35 PM
    • Member
      2 point Member
    • i3ny
    • Member since 09-19-2009, 5:23 PM
    • Posts 2

    Im having the problem that the silverlight video will go on in playing. this is the script im using to close the window"


    <script type="text/javascript">

    function cancel() { window.parent.document.getElementById('btnCancel').click(); }

    </script>

    <body>

    <div class="TitlebarRight" onclick="cancel();">Close></div>

    </body>


    the window closes and everithing but wont stop the video. 


    thank you.


    ps.

    its a modalpopup in a iframe, the iframe its a silverlight video. and it works its just the popup after closed video stil goes on.

Page 1 of 1 (5 items)