Jul 20, 2012, 2:47 AM
[CLOSED] How to configure a message box for the Failure handler?
Hi,
I need to display a custom error prompt message box when a DirectEvent execution returns failure. I've noticed that I couldn't use the server side MessageBox object if I set the DirectEventArgs Success property to "false" in the DirectEvent code-behind. In that case, a generic error popup is shown.
Please suggest the best practice to achieve the desired behavior. I've been trying to do something like:
I need to display a custom error prompt message box when a DirectEvent execution returns failure. I've noticed that I couldn't use the server side MessageBox object if I set the DirectEventArgs Success property to "false" in the DirectEvent code-behind. In that case, a generic error popup is shown.
Please suggest the best practice to achieve the desired behavior. I've been trying to do something like:
<DirectEvents>
<Click OnEvent="Button1_Click" Success="onSuccess();"
Failure="Ext.Msg.show({
msg : 'Failed: '+result.errorMessage,
width : 400,
buttons : Ext.Msg.OK,
title : 'Error',
icon : 'icon-error',
fn : 'onFailure'
});"
</Click>
</DirectEvents>
protected void Button1_Click(object sender, DirectEventArgs e)
{
bool res = false;
if (!res)
{
e.Success = false;
e.ErrorMessage = "Some error occured!";
}
}
However, the icon displayed is only 16x16 and, more importantly, the onFailure delegate is never invoked.
Last edited by Daniil; Jul 20, 2012 at 2:32 PM.
Reason: [CLOSED]