NamingContainer issue

Discussion in 'ASP .Net Web Controls' started by Rob Blij, May 25, 2006.

  1. Rob Blij

    Rob Blij Guest

    Hi

    We have ported a .NET1.1 ASP.NET app to .NET2. All our user controls have
    been modified and I have found some strange behavior. Firstly I can see
    that the controls now get rendered at compile time instead of declaring them
    in the ascx.cs file. Then strange thing is: in our aspx page when we call
    Page.LoadControl(usercontrol) all the controls within the usercontrol dont
    get their unique ID ie ctl1_btnDetails etc except each repetition of the
    control get ID="btnDetails" so therefore none of the events work etc.

    The way I alleviated this problem is stange. After the
    Page.LoadControl(usercontrol) I set:
    usercontrol.NamingContainer.ID = "anythinghere" and then all the subcontrols
    get ID's etc correctly.

    Can someone explain this behavior?

    TIA
    Rob
     
    Rob Blij, May 25, 2006
    #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,239
    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,479
    Tumurbaatar S.
    Nov 27, 2005
  3. Rob Blij
    Replies:
    0
    Views:
    482
    Rob Blij
    May 25, 2006
  4. Rob Blij
    Replies:
    0
    Views:
    1,028
    Rob Blij
    May 25, 2006
  5. Dan
    Replies:
    1
    Views:
    520
    =?Utf-8?B?TWlsb3N6IFNrYWxlY2tpIFtNQ0FEXQ==?=
    Apr 4, 2007
Loading...

Share This Page