1

我有一个 ModalPopUpExtender,单击取消按钮时,它应该重置 ModalPopUpExtender 的原始形式,就像它在Page_Load. 任何帮助将不胜感激

4

2 回答 2

0

ASPX:

<head id="Head1" runat="server">
    <title>Modal Popup</title>
    <style type="text/css">
        .modalStyle
        {
            background-color: Gray;
            filter: alpha(opacity=70);
            opacity: 0.7;
        }

        .panelStyle
        {
            width: 300px;
            height: 180px;
            border: 2px solid Gray;
            background-color: White;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <asp:Button ID="btnShow" runat="server" Text="Show" />
    <asp:ToolkitScriptManager ID="scripManager" runat="server" />
    <asp:ModalPopupExtender ID="modal" BackgroundCssClass="modalStyle" PopupControlID="popup" TargetControlID="btnShow" runat="server" />
    <asp:Panel runat="server" ID="popup" CssClass="panelStyle">
        <div>
            <asp:Button ID="btnCancel" runat="server" OnClick="HideModal" Text="Cancel" />
        </div>
    </asp:Panel>
    </form>
</body>

后面的代码:

protected void HideModal(object sender, EventArgs e)
{
    System.Diagnostics.Debugger.Break();
    modal.Hide();
    //Execute the reset logic
}
于 2013-04-08T14:33:25.920 回答
0

隐藏ModelPopupExtender我们单击取消按钮时需要在控件中使用CancelControlID属性。ModalPopupExtender

于 2013-12-09T16:39:19.383 回答