1.前台代码
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdateProgress ID="UpdateProgress1" runat="server" DisplayAfter="0" AssociatedUpdatePanelID="UpdatePanel1">
<ProgressTemplate>
</ProgressTemplate>
</asp:UpdateProgress>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
//中间代码......
</ContentTemplate>
</asp:UpdatePanel>
</form>
2.后台代码
当前台有UpdatePanel控件时,后台的Response.write("<script language=javascript>alert('提示信息');window.parent.window.parent.closeWindown()")就失效,不回弹出提示信息,这时候就需要应用到 ScriptManager.RegisterClientScriptBlock(Control, Type, "click", "alert('提示信息!')", true);
例如:在Button_Click事件中
string script="alert('用户组创建成功!');window.parent.window.parent.closeWindown();window.parent.main.location='UserGroup.aspx';";
ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "click", script, true);