[CLOSED] DirectMethods: How to replace timeout "transaction abort" message with a custom message?

  1. #1

    [CLOSED] DirectMethods: How to replace timeout "transaction abort" message with a custom message?

    Hi,

    As per title, I would like to override the error message "transaction abort" when there is a DirectMethods timeout with a customized message. Please advice if this is possible and how to do it?

    Thanks and regards.
    Last edited by geoffrey.mcgill; Nov 15, 2011 at 3:13 AM. Reason: [CLOSED]
  2. #2
    Hi,

    Please look at the example.

    Example

    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        [DirectMethod]
        public void AbortTransaction()
        {
        }
    </script>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Ext.Net Example</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server">
                <Listeners>
                    <AjaxRequestException Handler=" if (response.isAbort && !o.directMethodFailure) {
                                                       alert('Aborted (I am defined globally)');
                                                   }" />
                </Listeners>
            </ext:ResourceManager>
    
            <ext:Button runat="server" Text="Global message">
                <Listeners>
                    <Click Handler="Ext.net.DirectMethods.AbortTransaction({
                                        timeout : 10,
                                        showFailureWarning : false
                                    });" />
                </Listeners>
            </ext:Button>
            <ext:Button runat="server" Text="Custom 'aborted' message">
                <Listeners>
                    <Click Handler="Ext.net.DirectMethods.AbortTransaction({
                                        timeout : 10,
                                        showFailureWarning : false,
                                        failure : function (result, response, control, eventType, action, extraParams, o) {
                                            if (response.isAbort) {
                                                alert('Aborted (I am defined for a specified DirectMethod)');
                                            }
                                        }
                                    });" />
                </Listeners>
            </ext:Button>
        </form>
    </body>
    </html>
  3. #3
    Hi Daniil,

    Thanks. How about if the DirectMethod has a passed parameter? [i.e. AbortTransaction(int value1, string value2) ]
  4. #4
    No problem, a config should be at the end of all parameters.
  5. #5
    Hi Daniil,

    Sorry but can you give an example on how to construct the javascript if the DirectMethod is like below?

    <script runat="server">
        [DirectMethod]
        public void AbortTransaction(int width, int height)
        {
        }
    </script>
  6. #6
    Example
    Ext.net.DirectMethods.AbortTransaction(width, height, {
        timeout : 10,
        showFailureWarning : false
    });
    See also:
    https://examples1.ext.net/#/Events/D...hods/Overview/
  7. #7
    Hi Daniil,

    As always, appreciate your help.

    Thanks and regards.

Similar Threads

  1. Replies: 5
    Last Post: May 02, 2012, 5:37 PM
  2. Replies: 2
    Last Post: Apr 05, 2012, 4:55 AM
  3. Replies: 4
    Last Post: Oct 11, 2011, 2:42 AM
  4. Replies: 4
    Last Post: Aug 24, 2011, 11:29 AM
  5. Replies: 3
    Last Post: Sep 22, 2010, 10:30 AM

Tags for this Thread

Posting Permissions