簡體   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