ASP.NET中使用AJAX时如何弹出对话框

来源:互联网 发布:php字符串转义函数 编辑:程序博客网 时间:2024/05/16 14:49

在ASP.NET页面上添加AJAX控件后,不能调出窗口的解决办法:
ASP.NET2.0中AJAX使用新的ScriptManager 类来管理,而不兼容原来的 ClientScriptManager 类 ,所以用
<script>alert('提示:产品添加成功!')</script>和
this.ClientScript.RegisterClientScriptBlock(this.GetType(), "name", "<script>alert('提示:产品添加成功!');</script>", true);
 Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "name", "<script>alert('提示:产品添加成功');</script>", true); 
这些方法都是无效的.

可以用以下方法写代码实现

 ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "", "alert('提示:产品添加成功!');if(confirm('是否继续添加?取消转到产品管理页')){alert('本页面继续添加')}else{window.open('productManage.aspx','_self');}", true);

原创粉丝点击