摘要:__doPostBack事件後再執行某些事情
function test(){
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(clearPostBack);
__doPostBack("btnChkCpt", "");
}
function clearPostBack() {
SetCptCtrlDefault();
$get('__EVENTTARGET').value = $get('__EVENTARGUMENT').value = '';
Sys.WebForms.PageRequestManager.getInstance().remove_endRequest(clearPostBack);
// 執行某些事情
}
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<input type="button" onclick="test()" >
<asp:UpdatePanel ID="UpdatePanel1" runat="server" DefaultButton="lB_Refresh">
<ContentTemplate>
<asp:Button ID="btnChkCpt" runat="server" OnClick="btnChkCpt_Click" />
</ContentTemplate>
</asp:UpdatePanel>
注意:Sys.WebForms.PageRequestManager須配合ScriptManager與UpdatePanel使用,才能進入_endRequest事件裏