Closing modalpopupextender

Last post 05-09-2008 5:20 PM by whatispunk. 5 replies.

Sort Posts:

  • Closing modalpopupextender

    05-09-2008, 2:24 PM
    • Loading...
    • ayordy
    • Joined on 07-06-2006, 4:20 PM
    • Posts 7

    Is it possible to close a modalpopupextender just by clicking somewhere outside the popup?

    I need to have it close if a client clicks anywhere outside the modal, i.e. the parent page.

  • Re: Closing modalpopupextender

    05-09-2008, 3:35 PM
    • Loading...
    • JZoerman
    • Joined on 08-24-2006, 6:27 AM
    • Posts 98

    Correct me if I'm wrong, but it wouldn't be modal then. The HoverMenuExtender might give you the results you are looking for. Mouse over and you get your window, do something or not, and mouse out or did something and it's gone.

    Hope this helps.

    JZ

  • Re: Closing modalpopupextender

    05-09-2008, 3:42 PM
    • Loading...
    • ayordy
    • Joined on 07-06-2006, 4:20 PM
    • Posts 7

    unfortunately the hovemenuextender will not weork for me.

    there has to be a way to close the modalpopupexteder this way.

  • Re: Closing modalpopupextender

    05-09-2008, 4:59 PM
    • Loading...
    • whatispunk
    • Joined on 03-06-2007, 5:21 PM
    • Winnipeg
    • Posts 509

    I agree with JZoerman. The purpose of a modal dialog is to restrict the user from interacting with the window behind. However, if you want to do this here's an idea.

    The modal works something like this

     

                Page underneath
                        |
    ___________V___________
    |                                    <----------------- modalBackground
    |              _______             | 
    |              |            |           |
    |              |         <------------------------------ modalDialogue
    |              |_______|           |
    |                                       |
    |                                       |
    |______________________|

    So all you have to do is attach an event to your modalBackground that hides the modalDialogue when it recieves focus.

    Sorry, I'm actually quite ashamed of that diagram. But do you get the point? Stick out tongue

    Don't forget to click "Mark as Answer" if someone answers your question. Feel free to mark more than one answer, if you feel so inclined.
  • Re: Closing modalpopupextender

    05-09-2008, 5:00 PM
    • Loading...
    • whatispunk
    • Joined on 03-06-2007, 5:21 PM
    • Winnipeg
    • Posts 509

    Wow that rendered perfectly!! Sad

    Don't forget to click "Mark as Answer" if someone answers your question. Feel free to mark more than one answer, if you feel so inclined.
  • Re: Closing modalpopupextender

    05-09-2008, 5:20 PM
    Answer
    • Loading...
    • whatispunk
    • Joined on 03-06-2007, 5:21 PM
    • Winnipeg
    • Posts 509

    Okay, so this interrested me enough to stop being lazy and figure it out. It's actually pretty simple.

    The example I provide would require you to show/hide the modal using javascript. But it is still possible if you are doing it another way. It would just require more code.

    Basically, when your modal is shown a "behavior" is created. All you have to do is when the modal appears attach an eventhandler to its background element to hide the modal on the click event. 

    $addHandler($find("modalBehavior")._backgroundElement,'focus',hideModal);
    Then in the hideModal function you have to remove the handler like this:
    $removeHandler($find("modalBehavior")._backgroundElement,'focus',hideModal);
     

     

    Don't forget to click "Mark as Answer" if someone answers your question. Feel free to mark more than one answer, if you feel so inclined.
Page 1 of 1 (6 items)