ASP中,用了AJAX的页面怎么弹出对话框?

2025-05-17 21:32:06
推荐回答(2个)
回答1:

HTML





Text="Button" />




----------------------------------------------

在ASP.NET页面上添加AJAX控件后,不能调出窗口的解决办法:

ASP.NET2.0中AJAX使用新的Manager 类来管理,而不兼容原来的 ClientManager 类
,所以用<>alert('提示:产品添加成功!')和
this.Client.RegisterClientBlock(this.GetType(), "name",
"<>alert('提示:产品添加成功!');", true);
Page.Client.RegisterClientBlock(this.GetType(), "name",
"<>alert('提示:产品添加成功');", true);
这些方法都是无效的.

可以用以下方法写代码实现
Manager.RegisterStartup(UpdatePanel1, UpdatePanel1.GetType(), "",
"alert('提示:产品添加成功!');if(confirm('是否继续添加?取消转到产品管理页')){alert('本页面继续添加')}else{open('productManage.aspx','_self');}",
true);

我把上面的简化了下,实现最简单的提示问题

就写在button的单击事件下
Manager.RegisterStartup(UpdatePanel1,UpdatePanel1.GetType(),"","alert('成功')",true);

回答2:

ScriptManager.RegisterClientScriptBlock(this.imgBtnBuy, this.imgBtnBuy.GetType(), "", "alert('操作成功!');", true);