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);
}
}
Disable all controls of asp.net page
Posted by
Rajesh Rolen
at
Tuesday, July 27, 2010
Labels: ASP.NET
0 comments:
Post a Comment