Showing posts with label clear control values in c#. Show all posts
Showing posts with label clear control values in c#. Show all posts

24 October 2011

how to disable the all controls in a page

private void Disable(Control c)
{
if ((c is TextBox) || (c is LinkButton) || (c is Button) || (c is CheckBox) || (c is CheckBoxList) ||
(c is RadioButtonList) || (c is DropDownList) || (c is Panel) || (c is ImageButton))
{
   ((WebControl)c).Enabled = false;
}
foreach (Control ct in c.Controls)
Disable(ct);
}