I resolved the issue by adding a placeholder control to the aspx file (design mode). Make sure it is contained within the AJAX update panel. Then when you need to enable the Modal Popup Extender, you can dynamically add modalpopupextender to placeholder during an Asynchronous Post Back Event. Then I would dynamically add the AJAX Modal Popup during the Asynchronous Post Back Event.
<asp:panel id="pnlSTARRetractionLoanDetails" runat="server" height="430px" width="850px" cssclass="collapsePanel" /> <asp:updatepanel id="upnlSTARRetractionLoanDetails" runat="server" updatemode="Conditional" ChildrenAsTriggers="false" /> <ContentTemplate> <!-- The Placeholder will contain the AJAX Modal Popup --> <asp:placeholder id="phModalPopups" runat="server"> </asp:placeholder>
(Make sure this is during AsyncPostBack and dont forget to update the AJAX Update Panel)
// Instantiate the AJAX Modal Popup Object AjaxControlToolkit.ModalPopupExtender pnlpopSTARRetractionRequestorDepartmentAddition; pnlpopSTARRetractionRequestorDepartmentAddition = new AjaxControlToolkit.ModalPopupExtender(); // Initialize the Modal Popup Properties pnlpopSTARRetractionRequestorDepartmentAddition.ID = "pnlpopSTARRetractionRequestorDepartmentAddition"; pnlpopSTARRetractionRequestorDepartmentAddition.TargetControlID = "imgSTARRetractionRequestorDepartmentAddition"; pnlpopSTARRetractionRequestorDepartmentAddition.PopupControlID = "pnlSTARRetractionRequestorDepartmentAddition"; pnlpopSTARRetractionRequestorDepartmentAddition.BackgroundCssClass = "modalBackground"; pnlpopSTARRetractionRequestorDepartmentAddition.DropShadow = true; pnlpopSTARRetractionRequestorDepartmentAddition.OkControlID = "btnSTARRetractionRequestorDepartmentAddition"; pnlpopSTARRetractionRequestorDepartmentAddition.OnOkScript = "insertNewSTARRequestorDepartment()"; pnlpopSTARRetractionRequestorDepartmentAddition.CancelControlID = "btnSTARRetractionRequestorDepartmentCancel"; // Add the popup to the PlaceHolder we positioned in the AXPX Form phModalPopups.Controls.Add( pnlpopSTARRetractionRequestorDepartmentAddition ); // Update the AJAX Update Panel to display the Modal Popup upnlSTARRetractionLoanDetails.update();
When the Modal Popup is added during an Asynchronous Post Back, you have to dynamically add during every post back you want the Modal Popup to be enabled.
I hope this helps out. I personally tried several different ways to disable the ModalPopupExtender and this ended up being the solution I used.