I am using asp.net ajax I have a javascript class that is inheriting from sys.ui.control and it's inside fileA.js

//file a.js

Type.registerNamespace("ajax.control");

Eajax.control = function (element) {

    ajax.control.initializeBase(this, [element]);


    // some other things here
}

....
ajax.control.prototype.set_processVariablesJSON = function (value) {
    this.processVariables = $.parseJSON(value);
}


ajax.control.registerClass('ajax.control', Sys.UI.Control);

I want to overwrite method ajax.control.set_processVariablesJSON in another file, let say the file name is fileB.js

i have an oEvent object that when setdata method called, i want to overwrite the function

oEvent.setData = function ($context, object) {
    this.$context = $context;
    this.object = object;

    oEvent.resetForm();
    //I am trying to save the old method here
    var oldScriptSelector = ajax.control.loadParameters;
    //and overwrite it here, i expect to get alert, but nothing happen
    ajax.control.loadParameters = function () {
        oldScriptSelector();
        alert(1);
    };
}

when i load the files with ScriptManager the file fileB.js load first and fileA.js load after that.

is there any method to overwrite it in another file and with this kind of load sequence?

Related posts

Recent Viewed