Click here to Skip to main content
15,885,546 members
Articles / Web Development / ASP.NET

Disable Child Controls Recursively

Rate me:
Please Sign up or sign in to vote.
4.00/5 (5 votes)
31 Oct 2010CPOL 21K   7  

Alternatives

Members may post updates or alternatives to this current article in order to show different approaches or add new features.

Please Sign up or sign in to vote.
13 Nov 2010jarvisa
public void ControlStatus(Control control, bool isDisable){ foreach (Control c in control.Controls) if (c.HasControls()) ControlStatus(c, isDisable); else { WebControl wc = c as WebControl; if (wc != null) ...
Please Sign up or sign in to vote.
13 Nov 2010PSU Steve
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. // to enable\disable the control & its child controls public...
Please Sign up or sign in to vote.
13 Nov 2010a_pess
Alternative For VB.NET Windows Forms Private Sub ControlEnabled(ByVal ctrl As Control, ByVal isDisable As Boolean) Me.ControlEnabled(ctrl, isDisable, True) End Sub Private Sub ControlEnabled(ByVal ctrl As Control, ByVal isDisable As Boolean, ByVal allowRecurse As...

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
Egypt Egypt
- BSc Computer Engineering
Ain Shams University - Faculty of Engineering

Comments and Discussions