页面遍历

 public static void format(System.Web.UI.Control page, bool bFalg)
        {
            int nPageControls = page.Controls.Count;
            for (int i = 0; i < nPageControls; i++)
            {
                foreach (System.Web.UI.Control control in page.Controls[i].Controls)
                {
                    if (control.HasControls())
                    {
                        format(control, bFalg);
                    }
                    else
                    {
                        if (control is TextBox)
                            (control as TextBox).Enabled = bFalg;
 
                       if (control is Button)
                            (control as Button).Enabled = bFalg;
                        if (control is CheckBox)
                            (control as CheckBox).Checked = bFalg;
}