C#页面弹出对话框的几种方式

    
C#页面弹出对话框的几种方式:


1、ClientScript.RegisterStartupScript(this.GetType(), "", "");
2、Page.RegisterStartupScript("", "");
3、Response.Write("");

另外注意:

1、如果alert的内容要换行,则需要加转义字符//n或//r//n,如:ClientScript.RegisterStartupScript(this.GetType(), "", "");  

2、Response.Write输出,会破坏页面的结构,所以页面上的样式就会混乱,应该是在后台注册脚本模式。registerstartupscript(this.updatepanel1, this.gettype(), "updatepanel1", "alert(1)", true);

你可能感兴趣的:(C#页面弹出对话框的几种方式)