欢迎光临
我们一直在努力

Asp.net 使用Ajax时如何弹出对话框介绍

HTML

 

<asp:Manager ID="Manager1" runat="server">        </asp:Manager>             <asp:UpdatePanel ID="UpdatePanel1" runat="server">            <ContentTemplate>                <asp:Button ID="Button1" runat="server" ="Button1_Click" Text="Button" /><br />            </ContentTemplate>        </asp:UpdatePanel>
----------------------------------------------

 

在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);
赞(0)
未经允许不得转载:福利吧|福利社|fuliba » Asp.net 使用Ajax时如何弹出对话框介绍

相关推荐

  • 暂无文章