Is there a way in C#/ASP.NET to make all text boxes on a page ReadOnly? I have in mind to do like the following but the ReadOnly property doesn't seem to be available.
Code:
private void CCEReadOnly(Control ctlParent)
{
foreach (Control ctlChild in ctlParent.Controls)
{
if (ctlChild.GetType().ToString().Equals("System.Web.UI.WebControls.TextBox"))
{
// ReadOnly property not available??
//ctlChild.ReadOnly = true;
}
// Check for more children
if (ctlChild.Controls.Count > 0)
{
CCEReadOnly(ctlChild);
}
}
}