Tuesday, June 17, 2008

'Target-less' ModalPopupExtender

When using the ModalPopupExtender in the AJAX Control Toolkit, you have to set the TargetControlID to a control that will be used to open the popup, such as a link or a button.

To open the popups only through code, you can create a dummy panel and assign it's ID to the ModalPopupExtender. Make sure you don't set the Visible property to false - if you want to prevent the dummy panel from affecting the layout, set the style property to "display: none;" instead.

No comments: