1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
| <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm3.aspx.cs" Inherits="WebApplication1.WebForm3" %>
<%@ Register TagPrefix="asp" Namespace="AjaxControlToolkit" Assembly="AjaxControlToolkit"%>
<!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 runat="server">
<title></title>
<style type="text/css">.modalBackground {
background-color:Gray;
filter:alpha(opacity=70);
opacity:0.7;
}</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="ClientButton" runat="server" Text="Launch Modal Popup (Client)" />
<asp:Button ID="ServerButton" runat="server" Text="Launch Modal Popup (Server)" OnClick="ServerButton_Click" />
<asp:ScriptManager ID="asm" runat="server" />
<asp:Panel ID="ModalPopup" runat="server"><iframe src="WebForm1.aspx" width="500px" height="500px"></iframe><br /><asp:Button ID="OKButton" Text="Close" runat="server" /></asp:Panel>
<ajaxToolkit:ModalPopupExtender ID="mpe" runat="server" TargetControlId="ClientButton"
PopupControlID="ModalPopup" OkControlID="OKButton" BackgroundCssClass="modalBackground" />
<script runat="server">
protected void ServerButton_Click(object sender, EventArgs e)
{
ClientScript.RegisterStartupScript(this.GetType(), "key", "launchModal();", true);
}
</script>
<script type="text/javascript">
var launch = false;
function launchModal()
{
launch = true;
}
function pageLoad() {
if (launch) {
$find("mpe").show();
}
}
</script>
</div>
</form>
</body>
</html> |