I'm using a FormView control (myFormView) with an EditItemTemplate which contains a number of child controls. When I use a standard ASP.Net DropDownList control (myDropList), I can obtain a reference to myDropList using the line below:
((DropDownList)myFormView.FindControl("myDropList"))
I can full access the properties of the myDropList and obtain the value currently selected. This is great.
However, I now need to use a 3rd party child control (FreeTextBox as found here http://www.freetextbox.com) in the FormView control. I've called the FreeTextBox control myFTB and I'm using a similar statement as above:
((FreeTextBox)myFormView.FindControl("myFTB"))
However, this returns null and thus I'm enable to retrieve property values for this.
Does anyone know why it is returning null? Is there some other way to retrieve the reference to the control?
TIA
You will need to use recursion to find the control in the controls hierarchy.
Try using the following method: