INamingContainer is irrelevant - same error whether or not it's declared.
This is a problem with the control itself and its relationship to the
containing page, not the IDs of child controls.
The problem was actually that when the controls are created, they're always
created with an ID of _ctl0. So, when I pull a reference to the control out
of session state and add it back to the page, I end up adding multiple
controls with the same ID. This confiuses ASP.NET, and so I end up with an
error.
I didn't find a way to persuade ASP.NET to automatically create a unique ID,
so I'm now generating a Guid to use as a Session state key and control ID,
and explicitly assigning my controls an ID in the Init phase of the page
lifecycle.
I'm not sure that a Guid is the best/most elegant way to do it, but it's the
least amount of code required to generate something I know to be unique
(hence the note "solved by hackery")..
"cld" <> wrote in message
news:...
> [This followup was posted to
> microsoft.public.dotnet.framework.aspnet.webcontro ls and a copy was sent
> to the cited author.]
>
> In article <>,
> says...
> > I've a web page that adds a custom control every time a button is
clicked.
> > I'm keeping a reference to each added control in Session state so I can
> > recreate existing controls every postback. However, the controls are
always
> > added with ID "_ctl0" rather than "_ctl1", "_ctl2" ..., so I get an
error:
> > "Multiple controls with the same ID '_ctl0' were found. FindControl
requires
> > that controls have unique IDs". What do I need to do to get this to
work?
> >
> > Thanks,
> >
> > Owen
> Perhaps you are missing a INamingContainer implementation. Please let me
> know if this helps you