ASP.NET AJAX: How to get a client instance created with the $create method?
-
03-07-2019 - |
Question
Using the client-side ASP.NET AJAX library, I have created an instance of a client component with the $create shortcut-method (http://msdn.microsoft.com/da-dk/library/bb397487(en-us).aspx). The object is attached to a DOM element. Now I need to get a reference to the instance, but it is neither registered on window or on the DOM element, and I cannot find it anywhere.
Does someone know how you can obtain a reference to the instance?
Best regards,
JacobE
Solution
Does the $find() routine find it?
OTHER TIPS
According to MSDN, Sys.Component.Create should return the object that it just created. And, $create is just a shortcut for Sys.Component.create.
Returns: A new instance of a component that uses the specified parameters.
So, try:
var instance = $create(someType);
Yes, the $find method turned out to be the solution for me.
I could probably also use the return value of $create if I had any influence on how the javascript was rendered on the page - but unfortunately I didn't... :-)