INamingContainer has change my controls event order.....

A

Alex Stevens

Hi All,

I have built a composite user web control and I've NOT implemented
INamingContainer.
It does implement IPostBackDataHandler to retrieve information entered into
the controls when the host page is submitted.

In the controls LoadPostData event, I retrieve the information entered and
act upon.
The information entered affects the way the control is rendered, so in the
controls CreateChildControls event, I build the objects as they should be
based, on the information the user entered and submitted.

Once I put the control onto a web form it worked fine in isolation, but once
I added other controls to the host page it fell over with the error:
"Multiple controls with the same ID '_ctl1' were found. FindControl requires
that controls have unique IDs."

Fair enough, so I go to my control and Implement INamingContainer so that it
prefixes all the controls within my user control with the main controls
name.
However, this effected another change. The LoadPostData event is now
executed after the CreateChildControls event. This means that I can't render
the control based on what was retrieved in the LoadPostData event????

This seems like a fairly sensible thing to do, so why when implementing
INamingContainer do the control base events change order???
How do I render the controls objects based on information retrieved in the
LoadPostData event????

Thanks

Alex
 

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,774
Messages
2,569,596
Members
45,143
Latest member
DewittMill
Top