FindControl finds controls outside the calling Control
Yes, the situation is fairly simple, you do a parentControl.FindControl("someOtherControl") in ASP.Net and you get controls that are not in parentControl. Why?
Because apparently, FindControl wants a NamingContainer in which to search. If the parentControl is not an INamingContainer, it will look into the parentControl's NamingContainer.
Sollution? Create your own FindControl method, one that recursively goes through the child controls and looks for the specific ID.
Because apparently, FindControl wants a NamingContainer in which to search. If the parentControl is not an INamingContainer, it will look into the parentControl's NamingContainer.
Sollution? Create your own FindControl method, one that recursively goes through the child controls and looks for the specific ID.
Comments
Be the first to post a comment