views:

201

answers:

3

Hi,

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

+1  A: 

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);
EndangeredMassa
+1  A: 

Does the $find() routine find it?

korchev
A: 

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... :-)

JacobE