遍历母板下所有控件,递归方式

private void GetControls(Control c)//c需要遍历查找的父控件
{
     if (c is HyperLink)
     {
         Response.Write(c.ID + "<br />");
         return;
     }
     if (c.HasControls())
         foreach (Control con in c.Controls)
             GetControls(con);
}
posted @ 2012-06-05 18:21  Setme  阅读(159)  评论(0编辑  收藏  举报