Hiding all panels on a web content form within a master page
- by Jack Marchetti
I'm trying to hide all panels on a page, when a button click occurs.
This is on a web content form, within a master page.
The contentplageholder is named: MainContent
So I have:
foreach (Control c in Page.Form.FindControl("MainContent").Controls) {
if (c is Panel) {
c.Visible = false;
}
}
This never find any panels. The panels are within an Update Panel, and I tried
foreach(Control c in updatePanel.Controls) { }
and this didn't work either. I also tried :
foreach(Control c in Page.Controls) { }
and that didn't work either.
Any idea what I'm missing here?