NamingContainer & FindControl()

D

Dan

Hi,

I created a custom control (ParentCustomControl) which is using a
custom template (implementing ITemplate interface), in the
instantiateIn method of this template I create all the controls I
need
(Label, textboxes, button) and I also create another custom control
(ChildCustomControl) which is using a custom template too.


My problem comes when I'm trying to access the child Controls of
ChildCustomControl with the FindControl method. I can access every
others controls with a call like this :


(this.FindControl("MyButton") as ImageButton)


I can also access the ChildCustomControl
(this.FindControl("ChildCustomControl1") as ChildCustomControl)) but
his childs are not accessible... I always get a null reference error,
I think it's could be related to the NamingContainer, because only
the
controls created in the the InstantiateIn method of
ChildCustomControl
are innaccessible...


Anyone can help ?


Thanks !
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top