-3

I am trying to override one function by replacing it with a different version. The function which I am trying to override is defined in a web resource of a control. But, I have tried the same for script resources, it works.

function HookCalendarFunction() {
    try {
        var Original_performLayout = _performLayout;
        _performLayout = function () {
            performLayout();
        };
        var Original_cell_onclick = _cell_onclick;
        _cell_onclick = function (val) {
            cellClick(val);
        };
    }
    catch (e) {

    }

}

Here, _performLayout is a function for a custom control in ASP.net. _performLayout is in web resources of the control.

Thanks Ashwani

JPReddy
  • 63,233
  • 16
  • 64
  • 93
Ashwani K
  • 7,880
  • 19
  • 63
  • 102
  • 5
    You've been a member for *a year and nine months* and asked *53* previous questions. You really, really should be able to format code by now. To the right when you were asking this or any of your 53 previous questions there was this handy **How to Format** box. Worth a read, as is [the page linked](http://stackoverflow.com/editing-help) from the **[?]** just above the question area. – T.J. Crowder Mar 11 '11 at 14:46
  • Sorry for the formatting :(. While calling this function, exception is thrown saying "_performLayout is not found". The same method works if I try to override a method in script resources in asp.net. – Ashwani K Mar 11 '11 at 14:49

2 Answers2

1

Check _performLayout is global and your that declaration happens after the original declaration.

Guillaume86
  • 14,341
  • 4
  • 53
  • 53
0

I solved the issue, the issue was with the scope of function.

Ashwani K
  • 7,880
  • 19
  • 63
  • 102