现在的位置: 首页 > 综合 > 正文

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

2012年10月29日 ⁄ 综合 ⁄ 共 614字 ⁄ 字号 评论关闭
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;
       }

抱歉!评论已关闭.