Avatar of ukerandi
ukerandi
Flag 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

C#JavaScriptASP.NET

Avatar of undefined
Last Comment
Rajar Ahmed

8/22/2022 - Mon
SOLUTION
Carl Tawn

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ASKER CERTIFIED SOLUTION
Rajar Ahmed

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23