add_beginRequest事件會發生在請求之前,以下面例子,
當發生postback時,會先把觸發postback事件的物件(如按鈕)隱藏,
之後在畫面上面寫入【作業處理中,請稍候...】字樣,
之後執行完postback後要處理的功能後,畫面就會刷新還原。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="http://code.jquery.com/jquery-1.10.2.js"></script> | |
<script type="text/javascript" language="javascript"> | |
//postback,先處理按鈕 | |
Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(BeginRequestHandler); | |
function BeginRequestHandler(sender, args) | |
{ | |
var oControl = args.get_postBackElement(); | |
$(oControl).hide(); | |
$('#sMsg').html('作業處理中,請稍候...'); | |
} | |
</script> | |
<span id='sMsg'></span> |
沒有留言:
張貼留言