 <pre><code>Panel div = new Panel(); Panel innerdiv = new Panel(); TextBox txt = new TextBox(); innerdiv.Controls.Add(txt); div.Controls.Add(innerdiv); CustomAttributes.Controls.Add(div); </code></pre> <p>Your <code>CustomAttributes</code> holds <code>Panel</code>. Try this :</p> <pre><code>var textboxes = CustomAttributes.Controls.OfType&lt;Panel&gt;() .Select(p =&gt; p.Controls.OfType&lt;Panel&gt;().First()) .Select(p =&gt; p.Controls.OfType&lt;TextBox&gt;().First()) </code></pre>