2011-04-24 114 views

回答

0

感謝根據您鏈接的代碼,這個插件的工作方式是通過訂閱onbeforeunload事件。我不相信UpdatePanel執行異步請求時會觸發此事件。

看看這裏如何手動觸發驗證的例子:calling onbeforeunload from an updatepanel(注意,從提供的鏈接複製的代碼)

function pageLoad() { 
    Sys.WebForms.PageRequestManager.getInstance().add_initializeRequest(InitializeRequest); 
} 

// This fires before the partial postback occurs 
function InitializeRequest(sender, args) { 
    // Call the validation function here, should be something like this 
    handleOnBeforeUnload(); 
}