Wednesday, March 21, 2012

ModalPopup above existing and how to open a ModalPopup programmatically

Can I create a new ModalPopup control (Ajax Extender) and open it above an existing (already shown) ModalPopup?

And how can I open a ModalPopup programmatically instead of using a control?

I have tried to open a modalPopup on top of another one and it simply doesn't work, the second modal popup is forced to the right of the screen due to it's positioning being based upon the first one, not the screen. If anyone has a solution I would love to hear.

You can open a Modalpopup from code-behind by calling modalPopup.Show().

If you want to do it from javascript client side, you have two choices:

1. Create a hidden linkButton on the page and use this as the ModalPopup control trigger. From your Javascript you can call linkButton.click() which will open the modal popup.

2. From javascript, get a handle on the extender using it's PopupBehaviourID and use: $get(popupBehaviourID).show()

Andy.


How can I add an event listener that will execute a JavaScript function when the Show method of one of the ModalPopup is called?

I think that I can change its position right after it appears on the screen, but I have to test my idea.


Not sure about the event listener, but if you get this working ok please post back as this is something I require and cannot get to work :(

Andy.


hi Andy, i had tried the 2rd, but it's didn't worked.

the javascript error is that $get(popupBehaviourID) always return a null value.

i can see that the ModalPopupExtender is not rendered as an html element, so $get(popupBehaviourID) can not return an object

No comments:

Post a Comment