繁体   English   中英

脚本管理器弹出窗口没有出现

[英]Script manager popup doesn't appear

我有一个ASP.NET页。 单击页面上的某个按钮后,我想弹出一个窗口。 我使用的语法是这样的:

ScriptManager.RegisterStartupScript(this, this.GetType(), "popup", "alert('Invalid Address!!');", true);

弹出窗口没有出现。

但是,当在同一项目的不同页面上尝试相同的语法时,它可以工作。

有任何想法吗?

尝试将以下行从

ScriptManager.RegisterStartupScript(this, this.GetType(), "popup", "alert('Invalid Address!!');", true);

ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "popup", "alert('Invalid Address!!');", true);

如果以上原因导致上述代码无法正常工作,请尝试以下操作

 ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alert",
                            "Javascript:displayAlert('Invalid Address!!');", true);

和你的JS功能

function displayAlert(msg) {
   alert(msg);
   return false;
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM