码迷,mamicode.com
首页 > 其他好文 > 详细

如何在使用了updatepanel后弹出提示信息

时间:2014-11-29 17:24:49      阅读:127      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   ar   color   os   使用   sp   java   

转载: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>");
}

 

 

如何在使用了updatepanel后弹出提示信息

标签:style   blog   http   ar   color   os   使用   sp   java   

原文地址:http://www.cnblogs.com/zfanlong1314/p/4131190.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!