0

我必须创建 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>
4

1 回答 1

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()

于 2012-12-27T20:08:56.797 回答