You can just use "not
IsDisable
" versus the
IF
...
ELSE
block. Additionally, the recursive call to
ControlStatus
should be done all the time so that the parent control is enabled/disabled along with the children.
public void ControlStatus(Control control, bool isDisable)
{
foreach (Control c in control.Controls)
try
{
if (c is WebControl)
((WebControl)c).Enabled = !isDisable;
if (c.HasChildren)
ControlStatus(c, isDisable);
}
catch (Exception)
{ }
}
Enterprise architect/senior developer/SME for electronic warfare software development at the US Air Force 350th Spectrum Warfare Wing, Eglin AFB, FL.