Find the Child Control in the Root Control



The recursive function in order to loop the Parent Control's is given below
private Control FindControlRecursive(Control root, string id)
{
     if (root.ID == id)
    {
         return root;
    }

    foreach (Control c in root.Controls)
    {
          Control t = FindControlRecursive(c, id);
         if (t != null)
        {
             return t;
        }
    }

     return null;
}

X

Build smarter apps with Machine Learning, Bots, Cognitive Services - Start free.

Start Learning Now