views:

33

answers:

1

I am working on an ASP.net Ajax custom control, I have tried to derive from ScriptControl and a I also modified my code to implement the IScriptControl interface and do the nessecary wiring in the PreRender and Render methods.

The frameworks spits out a call to $create:

    Sys.Application.add_init(function() {
        $create(MyControl.DynamicFormAjax, 
         {"allowMoveRows":true,"isEditMode":true},
          null, null,$get("ctl00_body_dynaForm"));

The control is initialized and I draw itself during the initialize routine.

The issue I am having is that my page is then unable to get a reference to the Component (I can get the dom element just fine). I have tried to use $find("dynaForm") but it returns null.

I have also looked at Sys.Application.getComponents() and the only component I see is the Ajax Toolkit's Modal Popup that is also on this same page.

Thanks for any help!

A: 

I've managed to resolve my issue. It appeared that when the $create() would check the get_id() property of my component it would return an empty string.

I realized I had redefined my own _element member and a get_element() property. I removed these and it started working.

When I debugged this it looked like this.element was now returning an array of elements which is why the id property was undefined. Kind of odd that by defining a this._element=[element] in the function's constructor resulted in this._element becoming an array when called by the get_id() method

JoshBerke

related questions