Link to home
Start Free TrialLog in
Avatar of zavikon
zavikon

asked on

AJAX ModalPopupExtender will Not Hide in Asp.net

I have hit a wall with trying to figure this one out.  I have added an AJAX ModalPopupExtender (MPE) control to my asp.net page and it works as planned with the exception of closing/hiding it.  I feel like I have tried 15 variations from examples on the web, but it just will not close.  I suspect the issue relative to capturing the mpe object in my javascript function.  Following is my html code of the MPE.  Notice that I am calling a javascript function (fnCloseModal()) from my header which is my intended method of closing/hiding the MPE.  This javascript function does trigger correctly and I am also referencing it in the OnCancelScript property of the MPE.

<cc1:ModalPopupExtender ID="mp1" runat="server" PopupControlID="Panel1" TargetControlID="Panel1" BackgroundCssClass="modalBackground" OnCancelScript="fnCloseModal()">
                    </cc1:ModalPopupExtender>
                    <asp:Panel ID="Panel1" runat="server" CssClass="modalPopup" align="center" style="display:none;">
                        <div class="popup_Container">
                        <div class="popup_Titlebar" id="PopupHeader">
                            <div class="TitlebarLeft">
                                Monitor Name
                            </div>
                            <div class="TitlebarRight" onclick="fnCloseModal();">
                            </div>
                        </div>
                        <div class="popup_Body">
                            <asp:Image ID="Image1" runat="server" Height="640" Width="480" />
                        </div>
                        </div>
                    </asp:Panel>

Open in new window

My Javascript function that does trigger and shows my alert, however the modal is not closing:
function fnCloseModal() {
            alert("fnCloseModal")
            $find('<%=mp1.ClientID%>').hide();
        }

Open in new window

I suspect I am not finding the MPE in the javascript function correctly?  My HTML code is NOT in an Update Panel.  Thanks for your help.
ASKER CERTIFIED SOLUTION
Avatar of zavikon
zavikon

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial