I use the following method to return a parent control of a specific type. This method is recursive and uses generics.
<br /> private Control GetParentControl(Control control)<br /> {<br /> if (control.Parent.GetType() == typeof(T1))<br /> {<br /> return control.Parent;<br /> }<br /> else<br /> {<br /> return GetParentControl(control.Parent);<br /> }<br /> }</p> <p>