Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I suppose that you need to define events as it basically done in ASP.NET Client Side controls. So it is necessary to add the following to your MyTextBox client side object prototype:</p> <pre><code>add_textChanged: function(handler) { this.get_events().addHandler('shown', handler); } remove_TextChanged: function (handler) { this.get_events().removeHandler('textChanged', handler); } raise_textChanged: function (eventArgs) { var handler = this.get_events().getHandler('textChanged'); if (handler) { handler(this, eventArgs); } } </code></pre> <p>This will define client side event to which client code (parent controls or page) can subscribe and perform required actions. To raise this event in your MyTextBox you can use the code like this:</p> <pre><code>this.raise_textChanged(Sys.EventArgs.Empty); </code></pre> <p>And to use this event in MyWindow client side object you need to modify your code to the following:</p> <pre><code>Test.MyWindow = function (element) { Test.MyWindow.initializeBase(this, [element]); this._myTextBoxID = null; this._onTextChanged$delegate = Function.createDelegate(this, this._onTextChanged); }; Test.MyWindow.prototype = { initialize: function () { Test.MyWindow.callBaseMethod(this, 'initialize'); $find(this._myTextBoxID).add_textChanged(this._onTextChanged$delegate); }, _onTextChanged: function(sender, eventArgs) { // Perform required actions. // this - will be instance of the this client side object. } dispose: function () { $find(this._myTextBoxID).remove_textChanged(this._onTextChanged$delegate); Test.MyWindow.callBaseMethod(this, 'dispose'); } }; </code></pre> <p>Note: in the example provided I used this._myTextBox which equals to client id of the child MyTextBox control. You can use property "myTextBox" without performing $find because you initialize it using descriptor.AddComponent("myTextBox", _mtb.ClientID);</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload