2012-12-27 76 views
0

我必須創建ModalPopupExtender。爲此,我創建了一個簡單的應用程序和所有我的期望。但是,當我添加我的彈出窗口在母版頁中不起作用,我該如何解決這個問題?ModalPopupExtender

我彈出

<asp:Button ID="Button1" runat="server" Text="Click here to show iframe in modalpopup" /> 
     <asp:ModalPopupExtender ID="ModalPopupExtender1" BackgroundCssClass="ModalPopupBG" 
     runat="server" CancelControlID="btnCancel" OkControlID="btnOkay" TargetControlID="Button1" 
     PopupControlID="Panel1" Drag="true" PopupDragHandleControlID="PopupHeader"> 
     </asp:ModalPopupExtender> 
     <div id="Panel1" style="display: none;" class="popupConfirmation"> 
     <iframe id="frameeditexpanse" frameborder="0" src="InnerPage.aspx" height="161"> 
     </iframe> 
     <div class="popup_Buttons" style="display: none"> 
      <input id="btnOkay" value="Done" type="button" /> 
      <input id="btnCancel" value="Cancel" type="button" /> 
     </div> 
     </div> 

我在InnerPage.aspx

腳本
<script language="javascript" type="text/javascript"> 
     function okay() { 
     window.parent.document.getElementById('btnOkay').click(); 
     } 
     function cancel() { 
     window.parent.document.getElementById('btnCancel').click(); 
     } 
    </script> 

回答

1

地方這個腳本同一個頁面上有擴展

<script type="text/javascript"> 
    function clickOk() { 
     $get("<%= btnOkay.ClientID %>").click(); 
    } 

    function clickCancel() { 
     $get("<%= btnCancel.ClientID %>").click(); 
    } 
</script> 

和替代parent.window.document.getElementById().click()使用parent.window.clickOk()parent.window.clickCancel()