call it like this: DisableControls(Page ,false);
below code is to disable all controls of a asp.net page.
protected void DisableControls(Control parent,bool status)
{
foreach (Control ctrl in parent.Controls)
{
if (ctrl is TextBox)
((TextBox)ctrl).Enabled = status;
else if (ctrl is Button)
((Button)ctrl).Enabled = status;
else if (ctrl is RadioButton)
((RadioButton)ctrl).Enabled = status;
else if (ctrl is ImageButton)
((ImageButton)ctrl).Enabled = status;
else if (ctrl is CheckBox)
((CheckBox)ctrl).Enabled = status;
else if (ctrl is DropDownList)
((DropDownList)ctrl).Enabled = status;
else if (ctrl is HyperLink)
((HyperLink)ctrl).Enabled = status;
DisableControls(ctrl,status);
}
}
No comments:
Post a Comment