According to this page there is no way how to easily catch all exceptions which occur during callback processing (note that Page_Error and even global.asax Application_Error methods are not fired during callback processing). Of course, you can surround all of your codebehind callback methods with try ... catch blocks, but this is not elegent way how to catch all exceptions. We need one piece of code, where we can catch and process all unhandled exceptions.
The only solution I have found so far, is to create your own class which will derive from devexpress control, which you use to process callbacks (in our case ASPxCallbackPanel):
public class ASPxCallbackPanelExtended : ASPxCallbackPanel { protected override string OnCallbackException(Exception e) { Logger.Log(e); return base.OnCallbackException(e); } }
Than you will need to replace all existing ASPxCallbackPanelfrom your pages with ASPxCallbackPanelExtended:
<dev:ASPxCallbackPanelExtended ID="panPersonalData" ClientInstanceName="panPersonalData" runat="server" OnCallback="panelPersonalData_OnCallback" HideContentOnCallback="False" EnableCallbackCompression="true"> ... </dev:ASPxCallbackPanelExtended>
Yes, this solution is not perfect too, because you need to derive from all classes which can cause callbacks and override OnCallbackException method in your application (for example ASPxCallback), but this is the only solution I have found.