locked
How to add delay to _onFormSubmitCompleted function inside MicrosoftAjaxWebForms RRS feed

  • Question

  • User1570265326 posted

    I am trying to modify MicrosoftAjaxWebForms.js file which is default ajax file of asp.net 4.5 and ASP.NET AJAX Control Toolkit version is 16.1.0.0

    Here an example project to test out : https://github.com/FurkanGozukara/tempSite/

    Open project and go to trialpage.aspx and click that button. You will see the error

    Here the full MicrosoftAjaxWebForms.js : http://pastebin.com/pU3rBLKW

    It also uses functions from MicrosoftAjax.js if you need that : http://pastebin.com/CPCm9BZy

    What I want is, delaying the event 

    _onFormSubmitCompleted

    I have tried like below but it doesn't work.

    MicrosoftAjaxWebForms.js:914 Uncaught TypeError: this._tempCompleted is not a function

    It gives the error above

     _onFormSubmitCompleted: function (c) {
        console.log("_onFormSubmitCompleted");
        setTimeout(function () {
            this._tempCompleted(c);
        }, 1111);
    }, _tempCompleted: function (c) {
        console.log("testcompleted");
        this._processingRequest = true;
        if (c.get_timedOut()) {
            this._endPostBack(this._createPageRequestManagerTimeoutError(), c, null);
            return
        }
        if (c.get_aborted()) {
            this._endPostBack(null, c, null);
            return
        }
        if (!this._request || c.get_webRequest() !== this._request) return;
        if (c.get_statusCode() !== 200) {
            this._endPostBack(this._createPageRequestManagerServerError(c.get_statusCode()), c, null);
            return
        }
        var a = this._parseDelta(c);
        if (!a) return;
        var b, e;
        if (a.asyncPostBackControlIDsNode && a.postBackControlIDsNode && a.updatePanelIDsNode && a.panelsToRefreshNode && a.childUpdatePanelIDsNode) {
            var r = this._updatePanelIDs,
                n = this._updatePanelClientIDs,
                i = a.childUpdatePanelIDsNode.content,
                p = i.length ? i.split(",") : [],
                m = this._splitNodeIntoArray(a.asyncPostBackControlIDsNode),
                o = this._splitNodeIntoArray(a.postBackControlIDsNode),
                q = this._splitNodeIntoArray(a.updatePanelIDsNode),
                g = this._splitNodeIntoArray(a.panelsToRefreshNode),
                h = a.version4;
            for (b = 0, e = g.length; b < e; b += h ? 2 : 1) {
                var j = (h ? g[b + 1] : "") || this._uniqueIDToClientID(g[b]);
                if (!document.getElementById(j)) {
                    this._endPostBack(Error.invalidOperation(String.format(Sys.WebForms.Res.PRM_MissingPanel, j)), c, a);
                    return
                }
            }
            var f = this._processUpdatePanelArrays(q, m, o, h);
            f.oldUpdatePanelIDs = r;
            f.oldUpdatePanelClientIDs = n;
            f.childUpdatePanelIDs = p;
            f.panelsToRefreshIDs = g;
            a.updatePanelData = f
        }
        a.dataItems = {};
        var d;
        for (b = 0, e = a.dataItemNodes.length; b < e; b++) {
            d = a.dataItemNodes[b];
            a.dataItems[d.id] = d.content
        }
        for (b = 0, e = a.dataItemJsonNodes.length; b < e; b++) {
            d = a.dataItemJsonNodes[b];
            a.dataItems[d.id] = Sys.Serialization.JavaScriptSerializer.deserialize(d.content)
        }
        var l = this._get_eventHandlerList().getHandler("pageLoading");
        if (l) l(this, this._getPageLoadingEventArgs(a));
        Sys._ScriptLoader.readLoadedScripts();
        Sys.Application.beginCreateComponents();
        var k = Sys._ScriptLoader.getInstance();
        this._queueScripts(k, a.scriptBlockNodes, true, false);
        this._processingRequest = true;
        k.loadScripts(0, Function.createDelegate(this, Function.createCallback(this._scriptIncludesLoadComplete, a)), Function.createDelegate(this, Function.createCallback(this._scriptIncludesLoadFailed, a)), null)
    },

    How should i modify the entire javascript or that function to add a custom delay feature?

    So i can delay the client update at the client side as i wish after the postback is completed

    Here my bounty having related question : http://stackoverflow.com/questions/37237675/how-to-defer-the-update-at-the-client-side-after-async-postback-in-updatepanel

    Wednesday, June 8, 2016 1:40 PM

All replies

  • User1570265326 posted

    Here an example project to test out : https://github.com/FurkanGozukara/tempSite/

    Open project and go to trialpage.aspx and click that button. You will see the error

    Wednesday, June 8, 2016 10:27 PM
  • User61956409 posted

    Hi ceoffuture,

    Could you tell us what is your final goal? Please clarify clearly about the scenario that let you consider modifying MicrosoftAjaxWebForms.js.

    Best Regards,

    Fei Han

    Thursday, June 9, 2016 7:46 AM