title: Update panel in custom control is disappearing on postback
body: <p>I'm creating a custom control for the first time and I need some javascript to run as an initialization on the control. I've found that the only way I can get ScriptManager.RegisterStartupScript to execute on postback is if I tie it to an UpdatePanel. I added an update panel to my custom control and it will execute the javascript on the initial page load and for one postback but never again after that. I've narrowed the problem down to the fact that the update panel stops getting rendered to the page after the first postback. Everything else in the control gets rendered correctly except the update panel, which just disappears. The problem can be seen with this stripped down control.</p>
  
  <pre><code>public class SimpleTest : DataBoundControl
  {
      private UpdatePanel _updatePanel;
  
      protected override void CreateChildControls()
      {
          _updatePanel = new UpdatePanel();
          _updatePanel.ID = "testScriptUpdate";
          _updatePanel.UpdateMode = UpdatePanelUpdateMode.Always;
          Controls.Add(_updatePanel);
      }
  
      protected override void Render(System.Web.UI.HtmlTextWriter writer)
      {
          _updatePanel.RenderControl(writer);
      }
  
      protected override void OnInit(EventArgs e)
      {
          base.OnInit(e);
          EnsureChildControls();
      }
  }
  </code></pre>
  
  <p>And the button I'm using to do the postback is a simple </p>
  
  <pre><code>&lt;button type="button" onclick="__doPostBack('','');" &gt;PostBack&lt;/button&gt;
  </code></pre>
  
  <p>If you inspect the page, the update panel will be there the first time but, after clicking the button, won't show up again. I feel that I must be missing some setting to make this work but after hours of fiddling with this I need to ask for help.</p>