I am trying to perform control.enable = true/false on a page by looping through all the controls.
I have tried to modify the following method that I found on to suit my needs with no sucess.
Basically all that I want to do is:
problem with the code that i found is
1. I am not calling the method, and if i was i wouldn't know what to set as the "Root" or "ID"
2. Intellisense does not show that I can assign .Enabled to the discovered control.
Thanks in advance for your assistance.
I have tried to modify the following method that I found on to suit my needs with no sucess.
Code:
public static Control FindControlRecursive(Control Root, string Id)
{
if (Root.ID == Id)
return Root;
foreach (Control Ctl in Root.Controls)
{
Control FoundCtl = FindControlRecursive(Ctl, Id);
if (FoundCtl != null)
return FoundCtl;
}
return null;
}
Basically all that I want to do is:
Code:
foreach(Control ctl in Page.Controls)
{
ctl.Enabled = false;
}
problem with the code that i found is
1. I am not calling the method, and if i was i wouldn't know what to set as the "Root" or "ID"
2. Intellisense does not show that I can assign .Enabled to the discovered control.
Thanks in advance for your assistance.