[英]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.