转载:http://www.cnblogs.com/brusehht/archive/2009/03/19/1416802.html
常情况下,我们在使用ajax利用updatepanel实现页面局部刷新时需要有提示信息,而传统的方式是利用
Page.ClientScript.RegisterStartupScript来注册客户端脚本实现信息提示,但这种方式在ajax中不起作用,必须选择
System.Web.UI.ScriptManager.RegisterStartupScript来替代Page.ClientScript.RegisterStartupScript
例子.
System.Web.UI.ScriptManager.RegisterStartupScript(this.updatepanel1, this.GetType(), "unReport", "alert('保存成功!');window.close();", true);
下面给出一个函数用于实现弹出提示信息:
public static void Show(System.Web.UI.UpdatePanel updatePanel, string msg)
{
ScriptManager.RegisterStartupScript(updatePanel, updatePanel.Page.GetType(), "message", "alert('" + msg.ToString() + "');", true);
//page.ClientScript.RegisterStartupScript(page.GetType(), "message", "<mce:script language='javascript' defer><!--
alert('" + msg.ToString() + "');
// --></mce:script>");
}
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有