public void disableFormcontrols(Control parent)//
{
foreach (Control c in parent.Controls)
{
if (c.Controls.Count > 0)
{
disableFormcontrols(c);
}
else
{
switch (c.GetType().ToString())
{
case "System.Web.UI.WebControls.Text.Trim()Box":
((TextBox)c).ReadOnly = true;
break;
case "System.Web.UI.WebControls.CheckBox":
((CheckBox)c).Enabled = false;
break;
case "System.Web.UI.WebControls.RadioButton":
((RadioButton)c).Enabled = false;
break;
case "System.Web.UI.WebControls.DropDownList":
((DropDownList)c).Enabled = false;
break;
case "System.Web.UI.WebControls.Button":
cmdsave.Enabled = false;
break;
}
}
}
}
i tried using the same in my .aspx file using private instead of public
but there is no change in text controls
except the button control which gets disabled
i have the namespace