You have Panel1 but you are searching a table called MyPanel ??
protected void Button2_Click(object sender, EventArgs e)
{
Table t = (Table)Panel1.FindControl("T1");
}
This should get you the table
EDIT
Ok I dug up some old webForms stuff that does exacly this.
BUT you have to add your table on the initialize or preInit event of the page, if you want to interact with it in code later. And you have to Recreate the conrol on each postback.
public static Control FindControlRecursive(Control root, string id)
{
if (root.id == id)
return root;
foreach (Control ctrl in root.Controls)
{
Control FoundCtl = FindControlRecursive(ctrl, id);
if (FoundCtl != null)
return FoundCtl;
}
return null;
}
And you can use it lik this.
table myTable = FindControlRecursive(this.Master, "T1") as Table