title: How to create a MaskedEditExtender on the fly?
body: <p>I want to create a number of masked edit extenders from codebehind. Something like:</p>
  
  <pre><code>private MaskedEditExtender m_maskedEditExtender;
  protected override void OnLoad(EventArgs e)
  {
      base.OnLoad(e);
      m_maskedEditExtender = new MaskedEditExtender()
      {
          BehaviorID = "clientName"
      };
      m_maskedEditExtender.Mask = "999999999";
      this.Controls.Add(m_maskedEditExtender);
  }
  protected override void Render(HtmlTextWriter writer)
  {
      m_maskedEditExtender.RenderControl(writer);
  }
  </code></pre>
  
  <p>When I do this, I get a NullReferenceException on OnLoad of MaskedEditExtender. What is the correct way of doing that? Please note that putting the extender into a repeater-like control and using DataBind does not work for me.</p>
  
  <p><strong>Edit:</strong> I do not have an update panel. Turns out I also need to specify a target control on serverside.</p>