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
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