title: dynamic linkbutton not calling command when clicked
body: <p>New to dynamic controls, but until now I have been creating them successfully in a
  template field in my gridview, recently switched from a hyperlink to a link button
  and had to make some changes but still not working</p>
  
  <p>In my page I have the following code (abridged to salient parts)</p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
  {
      if (!this.IsPostBack)
      {
          ...
          ...
          TemplateField tf = new TemplateField();
          tf.HeaderText = "Action";
          tf.ItemTemplate = new AssignPage.MyTemplate(..., mylb);
          GridView1.Columns.Add(tf);
  
  
  protected void Page_PreInit(object sender, EventArgs e)
  {
      LinkButton lb = new LinkButton();
      lb.Text = "AssignAll";
      lb.Command += new CommandEventHandler(AssignAll_Click);
      lb.CommandName = "XXX";
      this.mylb = lb;
  
  
  
  
  protected void AssignAll_Click(object sender, CommandEventArgs e)   
  {
      string[] arg = new string[2]; // BREAK POINT HERE
      arg = e.CommandArgument.ToString().Split(';');
      ...
      ...
      Response.Redirect("BaseAndRepeats.aspx?id=" + r.Event.ID);
  </code></pre>
  
  <p>In the template class I have I have </p>
  
  <pre><code>    LinkButton lb;
  
      public MyTemplate(..., LinkButton _lb)
      {
          ...
          lb = _lb;
          ...
  
  
  
      public void InstantiateIn(System.Web.UI.Control container)
      {
              ...
              ...
              // various conditional statements
  
              lb.CommandArgument = mylist[rowCount].ReqtID.ToString() + ";" + mylist[rowCount].RotaUser;
              container.Controls.Add(lb);
              ...
  </code></pre>
  
  <p>The break point in the handler is never reached</p>
  
  <p>I thought I was creating the linkbutton in the right place 
  the linkbutton appears in the grid quite happily
  when I click on the linkbutton there is a call
  to Page_PreInit and to Page_Load and as I expected
  it is a postback.
  But AssignAll_Click is never called.</p>
  
  <p>In the browser footer it shows "javascript: __dooPsotabck(..." when you hover
  over the buttonlink</p>