且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

的RegisterClientScriptBlock混乱

更新时间:2023-12-05 23:46:52

我得到同样的问题,当我尝试从aspx页面的Page_Load事件中运行它,但是当我从身体的onload事件中运行它,它的工作原理。我认为这正在发生,因为在你的window.alert覆盖有要运行的机会发生在Page_Load事件。

I get the same problem when I try to run it from the page_load event of the aspx page, but when I run it from the body onload event it works. I think this is happening because the page_load event occurs before your window.alert override has a chance to be run.

试试这个在身体标记:

<body onload="alert('Your login attempt was not successful. Please try again.');">  

和jQuery的:

$(function () {

        window.alert = function (message) {
            $('#dialog').text(message).dialog();
        }

 });

我的方式使用jQuery UI的对话框插件。

I used the jQuery UI dialog plugin by the way.