NamingContainer & FindControl()

Discussion in 'ASP .Net Web Controls' started by Dan, Apr 4, 2007.

  1. Dan

    Dan Guest

    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 !
    Dan, Apr 4, 2007
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. msmail.microsoft.com

    NamingContainer and UserControl

    msmail.microsoft.com, Oct 10, 2004, in forum: ASP .Net
    Replies:
    8
    Views:
    4,197
    Shahar Prish
    Oct 13, 2004
  2. Tumurbaatar S.

    Dynamic columns and NamingContainer

    Tumurbaatar S., Nov 27, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    3,450
    Tumurbaatar S.
    Nov 27, 2005
  3. Rob Blij
    Replies:
    0
    Views:
    466
    Rob Blij
    May 25, 2006
  4. Rob Blij
    Replies:
    0
    Views:
    1,010
    Rob Blij
    May 25, 2006
  5. Dan
    Replies:
    1
    Views:
    505
    =?Utf-8?B?TWlsb3N6IFNrYWxlY2tpIFtNQ0FEXQ==?=
    Apr 4, 2007
Loading...

Share This Page