private Page FindPage(object X) { if (X is Page) { bFoundPage = true; _page2 = (Page)X; } else { if (!bFoundPage) { if (X is Control) { Control c = (Control)X; FindPage(c.Parent); } } } return _page2; }