+1-888-365-2779
Try Now
More in this section

Forums / Sitefinity SDK / Calling function from control designer

Calling function from control designer

4 posts, 0 answered
  1. higgsy
    higgsy avatar
    336 posts
    Registered:
    05 Aug 2010
    10 Feb 2011
    Link to this post
    Hi,

    I have a control designer which has all the usual applyChanges, refreshUI etc. How can I write a function that I can calls another function, not via an event handler. e.g.

    refreshUI: function() {
    myfunction();
    },
    myfunction: function() {
    alert('hi world');
    }

    Thanks
    higgsy
  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    15 Feb 2011
    Link to this post
    Hi higgsy,

    You are on the proper path to achieving this. When you call the function from other function you should use this.myfunction(). Consider sample bellow:
    refreshUI: function () {
        this.myFunction();
    },
     
    myFunction: function () {
        alert("hello world");
    }


    Kind regards,
    Radoslav Georgiev
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>
  3. higgsy
    higgsy avatar
    336 posts
    Registered:
    05 Aug 2010
    17 Feb 2011
    Link to this post
    Hi Radoslav,

    Thanks for your response, one other thing though - how do you pass parameters to that function, i.e.:

    refreshUI: function () {
        this.myFunction('Hello world');
    },
      
    myFunction: function (inputString) {
        alert(inputString);
    }

    Thanks
    higgsy
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    17 Feb 2011
    Link to this post
    Hi higgsy,

    There should not be a problem if you have this scenario

    refreshUI: function () {
        this.myfunction("test");
     
    },
     
    myfunction: function (param) {
        alert(param);
    },

    I attached short video

    Kind regards,
    Ivan Dimitrov
    the Telerik team
4 posts, 0 answered