ボタンを作成してパネルに追加しています
Panel p = new Panel();
p.ID = "b_con";
p.Attributes.Add("runat", "server");
this.Controls.Add(p);
Button b = new Button();
b.Attributes.Add("value", "reply");
b.Attributes.Add("id", Convert.ToInt32(r["Message_ID"]).ToString());
b.Attributes.Add("class", "button");
b.Click += new System.EventHandler(button_Click);
p.Controls.Add(b);
このエラーが発生しました Control 'ctl01' of type 'Button' must be place within a form tag with runat=server.