Application_Error ScriptManager, , . HttpContext.Current.Handler , ScriptManager, , .
, ScriptManager :
ScriptManager.GetCurrent(CType(HttpContext.Current.Handler, Page)).IsInAsyncPostBack
, , , ScriptManager, , Global.asax, :
Private Function GetCurrentScriptManager() As ScriptManager
'Attempts to get the script manager for the current page, if there is one
'Return nothing if the current request is not for a page
If Not TypeOf HttpContext.Current.Handler Is Page Then Return Nothing
'Get page
Dim p As Page = CType(HttpContext.Current.Handler, Page)
'Get ScriptManager (if there is one)
Dim sm As ScriptManager = ScriptManager.GetCurrent(p)
'Return the script manager (or nothing)
Return sm
End Function
Private Function IsInAsyncPostback() As Boolean
'Returns true if we are currently in an async postback to a page
'Get current ScriptManager, if there is one
Dim sm As ScriptManager = GetCurrentScriptManager()
'Return false if no ScriptManager
If sm Is Nothing Then Return False
'Otherwise, use value from ScriptManager
Return sm.IsInAsyncPostBack
End Function
IsInAsyncPostback() Application_Error, , .
ASP.NET , / , , , . , .
: ScriptManager , - AsyncPostBackErrorMessage Application_Error . . , ScriptManager OnAsyncPostBackError .
source
share