ajax modal popup hide

Last post 09-25-2008 11:35 AM by noirenex. 15 replies.

Sort Posts:

  • ajax modal popup hide

    06-30-2008, 6:00 AM
    • Member
      6 point Member
    • petercrymble
    • Member since 05-18-2008, 8:08 AM
    • Posts 23
    Hi I have a modal popup which contains an iframe. Within the iframe I have an aspx page with a form etc. What I want to happen is that when the submit button is clicked, it executes my code then closes the modal popup. However, because its within the iframe modalpopupextender1.hide wont work. Any ideas? I'm using vb.net Thanks Peter
    Filed under:
  • Re: ajax modal popup hide

    07-02-2008, 4:06 PM
    • Participant
      1,708 point Participant
    • mvang
    • Member since 12-27-2007, 6:59 PM
    • Mid West
    • Posts 361

    Can you assign the submit button to the CancelControlID of the modalpopup?

    "If you have knowledge, let others light their candles in it."
    — Margaret Fuller
  • Re: ajax modal popup hide

    07-02-2008, 4:33 PM
    • Member
      4 point Member
    • ntuyen01
    • Member since 07-02-2008, 3:33 PM
    • Posts 6

    I have a same problem. I try the sugguest above, but it does not work.

    Thanks and Regards, 

     

  • Re: ajax modal popup hide

    07-02-2008, 5:58 PM
    • Member
      657 point Member
    • conankingofcool
    • Member since 12-13-2007, 3:43 PM
    • Houston/Dallas, TX
    • Posts 141

    You might be able add some javascript to the page in the IFrame to access the modal popup in the parent page.  They talk about it in this thread. http://forums.asp.net/p/1058982/2079610.aspx.  Check out the last post on that thread.

    We're all in this together.
  • Re: ajax modal popup hide

    07-03-2008, 4:14 AM
    Answer

    Hi,

    Firstly, you can define a button in the IFrame page to trigger closing popup panel. And define OnClientClick event, which can execute hidepopup() javascript event in parent page before executing server click event.

            <asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="javascript:window.parent.hidepopup()" OnClick="Button1_Click"/>

    In the parent page, you need to declare hidepopup() event.

    function hidepopup()
    {
                var modalPopupBehavior = $find('ModalPopupBehavior'); // check the behavior you defined
                modalPopupBehavior.hide();
    }

    Hope it helps.

     


    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: ajax modal popup hide

    07-03-2008, 7:44 AM
    • Member
      6 point Member
    • petercrymble
    • Member since 05-18-2008, 8:08 AM
    • Posts 23
    that looks perfect. cant get to work (sorry to be stupid!) in the $find('modalpopupbehaviour') - is that the name of the extender (modalpopupextender1) or the panel? Thanks
  • Re: ajax modal popup hide

    07-03-2008, 10:09 AM
    • Member
      657 point Member
    • conankingofcool
    • Member since 12-13-2007, 3:43 PM
    • Houston/Dallas, TX
    • Posts 141

    You need to assign the Behavior property of the ModalPopupExtender to some name like 'modalpopupbehavior' and then it should work when you use the $find method.

    We're all in this together.
  • Re: ajax modal popup hide

    07-03-2008, 1:14 PM
    • Member
      6 point Member
    • petercrymble
    • Member since 05-18-2008, 8:08 AM
    • Posts 23
    cool. that really works! I decided against it as actually the onclientclick fires before the onclick function has completed. So it hides the modal popup before it finishes the function. But that code will be really useful in other places - so thanks. Peter
  • Re: ajax modal popup hide

    07-03-2008, 2:20 PM
    • Member
      4 point Member
    • ntuyen01
    • Member since 07-02-2008, 3:33 PM
    • Posts 6

    Would you please post your solution here so I can see it. Thanks

  • Re: ajax modal popup hide

    07-03-2008, 5:11 PM
    • Member
      6 point Member
    • petercrymble
    • Member since 05-18-2008, 8:08 AM
    • Posts 23
    1. In the Iframe you need a button: (note onclientclick) 2. On my parent page ( a master page in my case I have the following JS: function hidepopup() { var modalPopupBehavior = $find('ModalPopupBehavior'); // check the behavior you defined modalPopupBehavior.hide(); } 3. in the modal popup extender I added a behaviour ID: behaviourID="modalpopupbehavior"
  • Re: ajax modal popup hide

    07-21-2008, 5:26 PM
    • Member
      46 point Member
    • squidles79
    • Member since 06-03-2008, 9:36 PM
    • Posts 63

    Don't know if anyone's still watching this post or not....  Does anyone know how to do this in C#?  I can't quite figure out the translation.

    thanks!
     

  • Re: ajax modal popup hide

    07-21-2008, 6:28 PM
    • Participant
      1,708 point Participant
    • mvang
    • Member since 12-27-2007, 6:59 PM
    • Mid West
    • Posts 361

    squidles79:

    Don't know if anyone's still watching this post or not....  Does anyone know how to do this in C#?  I can't quite figure out the translation.

    thanks!
     

     Which parts are you talking about? Most examples are in C# besides the Javascript.

    "If you have knowledge, let others light their candles in it."
    — Margaret Fuller
  • Re: ajax modal popup hide

    07-21-2008, 6:35 PM
    • Member
      46 point Member
    • squidles79
    • Member since 06-03-2008, 9:36 PM
    • Posts 63

    Sorry...  I meant this:

    function hidepopup()
    {
                var modalPopupBehavior = $find('ModalPopupBehavior'); // check the behavior you defined
                modalPopupBehavior.hide();
    }

    Apparently I'm a big moron.  That makes more sense now.  Embarrassed

  • Re: ajax modal popup hide

    07-21-2008, 6:39 PM
    • Participant
      1,708 point Participant
    • mvang
    • Member since 12-27-2007, 6:59 PM
    • Mid West
    • Posts 361

    squidles79:

    function hidepopup()
    {
                var modalPopupBehavior = $find('ModalPopupBehavior'); // check the behavior you defined
                modalPopupBehavior.hide();
    }

     That's the Javascript part. Smile

    "If you have knowledge, let others light their candles in it."
    — Margaret Fuller
  • Re: ajax modal popup hide

    07-22-2008, 11:55 AM
    • Member
      46 point Member
    • squidles79
    • Member since 06-03-2008, 9:36 PM
    • Posts 63

     Yeah, I got that with the last post.  Sorry 'bout that.

Page 1 of 2 (16 items) 1 2 Next >