locked
Explicitly Closing Modal Popup Extender On Page Redirection RRS feed

  • Question

  • User-737250826 posted

    I have a modal pop up with Ok and Cancel buttons.

    On 'OK', I redirect to a new page that opens in a new tab. and On Cancel I close the pop up.I have the requirement to close the pop up after the user hits 'ok' and a new page is opened. But when I see the old page, the pop up is still open.

    I have used the .Hide() method after Response.Redirect but it doesn't works.

    Please advise.

    Tuesday, April 8, 2014 7:21 AM

Answers

  • User724169276 posted

    use javascript on OK Button to hide the modalpoup.

    <script language="javascript"> 
    function HideModalPopup() 
    {
     $find("mpepopup").hide(); 
    }
    </script> 

    on ok button:

    OnClientClick="return HideModalPopup();"

    and on the click event of the button write:

    protected void NewComponent_Click(object sender, EventArgs e)
            {
                if (.....)
                {
                    Response.Redirect(...);
                }
            }

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, April 8, 2014 7:39 AM
  • User555306248 posted

    To achieve your target, you have to handle it on client.

    1. Please use an updatepanel to wrap the button controls you used.

    2. Define an OnClientSide click event. In this event, you can call javascript "$find('behaviorID').hide();". (Don't define TargetControl to this button. Otherwise, it will not fire the server-side client event)

    3. Then it will call onclientside click event to hide the modalpop

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, April 8, 2014 10:57 PM

All replies

  • User724169276 posted

    show us the ok button click event codes ?

    Tuesday, April 8, 2014 7:28 AM
  • User1208776063 posted

    But when I see the old page, the pop up is still open.

    Do you mean redirecting back to the old page? If you are displaying modal popup on page load, you may need to modify that code to not show the popup using a queryparameter. Send hidePopup=0 for second page-first page navigation and use the hidepopup query parameter to decide whether popup should be shown

    Tuesday, April 8, 2014 7:31 AM
  • User-737250826 posted

    My Redirection opens a page in a new tab. The pop up is open in the original page. I want to close that.

    protected void NewComponent_Click(object sender, EventArgs e)
            {

               mpepopup.Hide();
                if (.....)
                {
                    Response.Redirect(...));
                }
            }

    Tuesday, April 8, 2014 7:31 AM
  • User724169276 posted

    use javascript on OK Button to hide the modalpoup.

    <script language="javascript"> 
    function HideModalPopup() 
    {
     $find("mpepopup").hide(); 
    }
    </script> 

    on ok button:

    OnClientClick="return HideModalPopup();"

    and on the click event of the button write:

    protected void NewComponent_Click(object sender, EventArgs e)
            {
                if (.....)
                {
                    Response.Redirect(...);
                }
            }

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, April 8, 2014 7:39 AM
  • User555306248 posted

    To achieve your target, you have to handle it on client.

    1. Please use an updatepanel to wrap the button controls you used.

    2. Define an OnClientSide click event. In this event, you can call javascript "$find('behaviorID').hide();". (Don't define TargetControl to this button. Otherwise, it will not fire the server-side client event)

    3. Then it will call onclientside click event to hide the modalpop

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, April 8, 2014 10:57 PM