原文:
最開始我用:
Response.Write("<script>alert(‘和哈呵呵呵呵呵呵!‘)</script>");
在沒有UpdatePanel時,這個有效,能夠正确彈出提示視窗。
後面,頁面改進,加上局部重新整理後,該方式失效了。探索出新的方式:
ScriptManager.RegisterStartupScript(this.UpdatePanel1,
this.GetType(),"updateScript",
"alert(‘已稽核,不能再修改!‘);", true);
經測試,能夠成功彈出視窗,還可以根據自己需求,增加一個變量,用于提示:
"alert(‘資料錯誤:" + errorInfo + "!‘);",
true);