Setting readonly for all textboxes C# ASP.NET

Can anyone suggest a way to set readonly of all textboxes . I tried using a a recursive function but it will say that \[code\]System.Web.UI.Control\[/code\] has no such definition for ReadOnly \[code\] private void SetReadOnly<T>(Control parent, bool isReadOnly){ foreach (Control ctrl in parent.Controls) { if (ctrl is T) ctrl.ReadOnly = isReadOnly; // this line here wont work . SetReadOnly<T>(ctrl, isReadOnly); }}\[/code\]Any alternatives please !!
 
Back
Top