Search code examples
asp.netdevexpresscustom-server-controls

How to add new method in aspxclienttextbox?


Can I add new method to aspxclienttextbox control?
I'm doing custom control on the aspxtextbox... I wish to add client-side method on the custom control and i have no idea on it... So anyone know how to make it?


Solution

  • I know of two methods to achieve this:

    1.Add method to object prototype:

    ASPxClientTextBox.prototype.NewMethod = function(param1) { console.log(param1); }
    

    According to this ticket you should place this code at the end of body section.

    2.Use ASPxTextBox ClientSideEvents.Init in your custom control code. This will dinamically register method for every ASPxTextBox instance (while first method modifies object prototype).

    ClientSideEvents.Init = "function(s,e) {s.NewMethod = function(param1) { console.log(param1); }}";