- Follow instructions here on wiring up the control, specifically the parts about implementing IScriptControl, and overriding OnPreRender() and Render(). However you *must* make one crucial change, or else you'll break ALL javascript on the page.
- You must change this line as follows:
Before:
var descriptor = new ScriptControlDescriptor("namespace.class", this.ClientID);
After: var descriptor = new ScriptControlDescriptor("namespace.class", someOtherControl.ClientID);
The problem is that user controls do not, per se, have an associated HTML control, so it's necessary to place the control's contents inside a Panel. If you do try to create a descriptor using "this", the un-handled error resulting from the $create() call on the client will cause all page-initialization-related Javascript that runs after that point to fail, thus breaking the page in a big way.