遍历 web页面控件

 protected void GetChildControl(Control ParentControl)
      {
          if (ParentControl.HasControls())
          {
              foreach (Control ctl in ParentControl.Controls)
              {
                  if (ctl.GetType().ToString() == "System.Web.UI.WebControls.TextBox")
                      ((System.Web.UI.WebControls.TextBox)ctl).Text = "分";

                  GetChildControl(ctl);
              }
          }
      }
     

posted on 2009-04-10 17:04  tongdengquan  阅读(125)  评论(0编辑  收藏  举报