脚本管理器弹出窗口不会出现 [英] Script manager popup doesn't appear
本文介绍了脚本管理器弹出窗口不会出现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个ASP.NET页面。我想在点击页面上的某个按钮扔一个弹出。我使用的语法是这样的:
I have an ASP.NET page. I want to throw a pop up upon clicking a certain button on the page. The syntax I used is this:
ScriptManager.RegisterStartupScript(this, this.GetType(), "popup", "alert('Invalid Address!!');", true);
弹出窗口没有出现。
The popup did not appear.
然而,试图在同一个项目在不同的页面相同的语法时,它的工作。
However, when trying the same syntax on a different page in the same project, it worked.
任何想法?
推荐答案
尝试从
ScriptManager.RegisterStartupScript(this, this.GetType(), "popup", "alert('Invalid Address!!');", true);
到
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "popup", "alert('Invalid Address!!');", true);
如果出于某种原因上面code不起作用,试试下面的,如果它的工作原理
If for whatever reason the above code doesn't work, try the below if it works
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alert",
"Javascript:displayAlert('Invalid Address!!');", true);
和您的JS功能
function displayAlert(msg) {
alert(msg);
return false;
}
这篇关于脚本管理器弹出窗口不会出现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文