Link to home
Start Free TrialLog in
Avatar of ukerandi
ukerandiFlag for United Kingdom of Great Britain and Northern Ireland

asked on

C# ASP.net - Java script

How to write this using C# ASP.net page load event
var script = @"<script type="text/javascript">
    //<![CDATA[
    var GlvDelayedNextPageNo;

    function WebForm_CallbackComplete_SyncFixed() {
        // the var statement ensure the variable is not global
        for (var i = 0; i < __pendingCallbacks.length; i++) {
            callbackObject = __pendingCallbacks[i];
            if (callbackObject && callbackObject.xmlRequest &&
                (callbackObject.xmlRequest.readyState == 4)) {
                // SyncFixed: line move below // WebForm_ExecuteCallback(callbackObject);
                if (!__pendingCallbacks[i].async) {
                    __synchronousCallBackIndex = -1;
                }
                __pendingCallbacks[i] = null;
                var callbackFrameID = "__CALLBACKFRAME" + i;
                var xmlRequestFrame = document.getElementById(callbackFrameID);
                if (xmlRequestFrame) {
                    xmlRequestFrame.parentNode.removeChild(xmlRequestFrame);
                }
                // SyncFixed: the following statement has been moved down from above;
                WebForm_ExecuteCallback(callbackObject);
            }
        }
    }

    var OnloadWithoutSyncFixed = window.onload;

    window.onload = function Onload() {
        if (typeof (WebForm_CallbackComplete) == "function") {
            // Set the fixed version
            WebForm_CallbackComplete = WebForm_CallbackComplete_SyncFixed;
            // CallTheOriginal OnLoad
            if (OnloadWithoutSyncFixed != null) OnloadWithoutSyncFixed();
        }
    }
    //]]>
";

Open in new window

SOLUTION
Avatar of Carl Tawn
Carl Tawn
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial