While debugging a problem I'm having on a DetailsView finding a control in one of the templates I encountered something strange. I have implemented a recursive FindControl Extension, and it where finding a control with an id completely different from the one I where searching for. the implementation is basically calling Findcontrol on the parent control, and afterwards if nothing where found, calling the recursive function on the child controls.
I started digging into the asp.net code with reflector and found out how the implementation for a checkboxs FindControl method where (The one in System.Web.UI.WebControls.CheckBoxList)
protected override Control FindControl(string id, int pathOffset)
{
return this;
}
This now all makes sense, why my FindControl found a CheckBoxList, I can however see no reasoning behind this implementation, could anyone enlighten me?