Not able to call javascript method defined in RadCodeBlock

1 posts, 0 answers
  1. Dheeraj
    Dheeraj avatar
    1 posts
    Member since:
    Jun 2012

    Posted 22 Feb 2013 Link to this post

    Hi, 
    I have a method defined in RadCodeBlock, when i am trying to call it on page load(by pushing my method in _spBodyOnLoadFunctionNames), i am getting error : The value of the property 'MyMethod' is null or undefined, not a Function object.

    (Note: I am using RadComboBox with Sharepoint 2010.)

    Below is the scenerio:
    <telerik:RadCodeBlock ID="RadCodeBlock" runat="server">
        <script type="text/javascript">
                function pageLoad() {
                   GetComboBox = function () {
                        var combo = $find("<%= MyRadComboBox.ClientID %>");
                        return combo;
                    };
                };
        </script>                    
    </telerik:RadCodeBlock>


    Method2 = function(){
    var combo = GetComboBox(); -->// getting error
    // do something
    }
     
    var index = ko.utils.arrayIndexOf(_spBodyOnLoadFunctionNames, "Method2");
    if( index === -1) {
        _spBodyOnLoadFunctionNames.push("Method2");
    }

     ERROR : The value of the property 'GetComboBox' is null or undefined, not a Function object.
Back to Top