Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > NamingContainer issue

Thread Tools

NamingContainer issue

Rob Blij
Posts: n/a

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?


Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
FindControl() method and NamingContainer Dan ASP .Net 1 04-04-2007 08:42 PM
NamingContainer.ID not being set on UserControl issue Rob Blij ASP .Net 0 05-25-2006 03:31 PM
NamingContainer property on UserControl Rob Blij ASP .Net 0 05-25-2006 08:34 AM
Dynamic columns and NamingContainer Tumurbaatar S. ASP .Net 2 11-27-2005 01:54 PM
NamingContainer and UserControl ASP .Net 8 10-13-2004 03:15 AM