NamingContainer issue

R

Rob Blij

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
 

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

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top