Pages

Friday, February 1, 2013

Find a control in detailsview

http://devtoolshed.com/content/find-control-templatefield-programmatically

can't use:

Label labCompany = (Label) DetailsView1.FindControl("LabelCompany");

this will not find the LabelCompany control because it is a child control of the DetailsView1 ... therefore, labCompany is not bound to anything ...

need to use a recursive function to loop through the layers of controls within a control such as DetailsView1