1
I’m trying to get the panels from a daughter page on Asp.net, but when I use the page. Controls, it only retrieves the elements from the master page.
I have tried this, Page.Page, but always the same result, the elements of the master page and not the page in question. See the algorithm I used
public static void mostrarPanels(List<String> panels, Page page)
{
ControlCollection controls = page.Controls;
foreach(Control control in controls)
{
ControlCollection controls2 = control.Controls;
if (control.GetType() == typeof(Panel)) {
control.Visible = false;
for (int i = 0; i < panels.Count; i++)
{
if (control.ID == panels[i])
control.Visible = true;
}
}
}
}
I’ll be doing something wrong?
Hello! See if this answer helps: https://stackoverflow.com/a/277654/1377664
– Sam