>>public static void SetEnabled(ControlCollection cc, bool enabled) >>{ >> foreach (Control control in cc) >> { >> WebControl webControl = control as WebControl; >> if (webControl != null) >> webControl.Enabled = enabled; >> } >>} >>>>
/// <summary> /// Sets enabled property of the passed controls /// </summary> /// <param name="cc"></param> /// <param name="enabled"></param> public static void SetEnabled(ControlCollection cc, bool enabled) { foreach (Control control in cc) { if (control is TextBox && control.ID != null) ((TextBox) control).ReadOnly = ! enabled; if (control is DropDownList && control.ID != null) ((DropDownList) control).Enabled = enabled; if (control.Controls.Count > 0) { clseditmode.SetEnabled(control.Controls, enabled); } } }