Ajax弹出层操作代码

来源:互联网 发布:淘宝秋季外套女装新款 编辑:程序博客网 时间:2024/06/16 00:36

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="tanchucengaspx.aspx.cs" Inherits="tanchucengaspx" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
 <head id="Head1" runat="server">
    <title></title>
    <style type="text/css">
        .modalBackground
        {
            background-color: Gray;
            filter: alpha(opacity=70);
            opacity: 0.7;
        }
        #Panel1{ width:300px; height:200px; background-color:Blue;}
    </style>
   
    <script type="text/javascript">
        function showinfo() {
            alert('关闭');
        }

    </script>

</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <div>
        <asp:Panel ID="Panel1" runat="server">
            <asp:Button ID="btnok" runat="server" Text="确定" /><asp:Button ID="btnclose" runat="server"
                Text="关闭" />
        </asp:Panel>
        <asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="LinkButton1"
            PopupControlID="Panel1" BackgroundCssClass="modalBackground" DropShadow="true"
            OkControlID="btnok" CancelControlID="btnclose" OnOkScript ="showinfo()">
        </asp:ModalPopupExtender>
        <asp:LinkButton ID="LinkButton1" runat="server">Click Me</asp:LinkButton>
    </div>
    </form>
</body>
</html>