title: RegisterClientScriptResource + AJAX update panel
body: <p>I have a problem that is really making me feel dumb.  I have a custom control that inherits textbox.  This textbox (at least for this example) simply has a .js file that is embedded in the .dll.</p>
  
  <p>Long story short, works great when not in an AJAX update panel.  So i did some research and found that instead of using:  Page.ClientScript.RegisterClientScriptResource, i should use ScriptManger.RegisterClientScriptResource - i have done this in the overrdive render method, but the javascript still does not fire.</p>
  
  <p>Anyone know what im doing wrong?</p>
  
  <p>example:
  i have a folder in my project called Scripts - it contains myscript.js
  My Assembly is called Jim.Bob.Controls</p>
  
  <p>I add attributes to my controls ie: Attributes.Add("onclick", "Test2();");</p>
  
  <p>In the Override Render:</p>
  
  <pre><code>ScriptManager.RegisterClientScriptResource(this.Page, typeof(CustomTextBox), "Jim.Bob.Controls.Scripts.myscript.js");
  </code></pre>
  
  <p>Yet i still get 'object expected' error.</p>
  
  <p>I need my textbox to work with and w/o AJAX.  I imported System.Web.Extensions into my project to access ScriptManger</p>
  
  <p>Can someone please tell me what im doing wrong?  Again, this whole thing worked fine w/o AJAX, i have put the necessary stuff into the AssemblyInfo.cs (WebResource:,,,,etc)</p>
  
  <p>Thanks in advance :-)</p>
  
  <p>--- UPDATE ---
  I reverted the control, trying it in a non AJAX web and i am having the same problem.  Not sure why i have a problem, i have another custom control in the same assembly that is working just fine - have them setup the exact same way, only difference is the one that is working inherits WebControl, the one that is not inherits TextBox
  ... 
  in the one that is working i emmit html like Go and do it
  Where the one that is NOT working i have
  Attributes.Add("onclick", "CustomFunction();");</p>
  
  <p>Also, if i do Attributes.Add("onclick", "alert('hello');"); 
  it works fine.</p>
  
  <p>Sorry for such a long post.</p>