chiname

  博客园 :: 首页 :: 新随笔 :: 联系 :: 订阅 :: 管理 ::

一个任意获得页面控件的方法

private Control seachControl(Control it,string id)
 {
            Control oo=null;
            foreach(Control c in it.Controls)
              {
                oo=c.FindControl(id);
               if (oo!=null)
              {
                   
                    break;
               }

               else
                    {
                    if (c.Controls.Count>0)
                   {
                      oo=seachControl(c,id);
                       if (oo!=null)
                            {
                               return oo;
                       }

                  }

               }

    }

    return oo;
       }
posted on 2006-02-10 11:25  把我的欢乐带给你  阅读(74)  评论(0)    收藏  举报