C# Javascript警报未显示

C# Javascript警报未显示,c#,javascript,asp.net,C#,Javascript,Asp.net,无法从我的代码隐藏中显示javascript警报 c#-点击按钮 if (response != "") { ClientScript.RegisterStartupScript(typeof(Page), "AlertPopup", "<script type='text/javascript'>alert('Day already exists, please edit the existing day');</script>"); return;

无法从我的代码隐藏中显示javascript警报

c#-点击按钮

if (response != "")
{
    ClientScript.RegisterStartupScript(typeof(Page), "AlertPopup", "<script type='text/javascript'>alert('Day already exists, please edit the existing day');</script>");
    return; 
}

由于它来自UpdatePanel,请尝试使用
ScriptManager.RegisterStartupScript
静态方法


HTH.

用Firebug或Devtools检查HTML/script正在加载什么。BTW,没有“C#NET”之类的东西。该语言名为“C#”。@Michael-Good call,它在HTML:alert中加载了该语言(“日期已存在,请编辑现有日期”)@威尔:好的。我提到这一点是因为有些人认为它是“C#.NET”,因为它是“VB.NET”。解决方案已找到并添加到我的帖子中
ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "AlertPopup", "<script type='text/javascript'>alert('Day already exists, please edit the existing day');</script>", true);
ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "AlertPopup", "alert('Day already exists, please edit the existing day');", true);