FindParent
A simple type safe method to find a parent control
Source
public static T FindParent<T>(this Control target) where T : Control
{
if (target.Parent == null)
{
return null;
}
var parent = target.Parent as T;
if (parent != null)
{
return parent;
}
return target.Parent.FindParent<T>();
}
Example
someControl.FindParent<RepeaterItem>().UniqueID;