You can just use "not
" versus the
block. Additionally, the recursive call to
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)
if (c is WebControl)
((WebControl)c).Enabled = !isDisable;