Multiple controls with the same ID '_ctl0:_187f384120d0' were found!

  • Thread starter Thread starter Anders Borum
  • Start date Start date
A

Anders Borum

Hello!

I'm building pages dynamically, by loading usercontrols recursively and
adding the to eachother. My problem is usercontrols - defined with
output-caching directives. When these usercontrols area loaded, they're
returned as PartialCachingControls.

The UniqueID of the PartialCachingControl is first assigned, when it is
added to the controls collection of the parent control. This is where I'm
getting an error.

My problem: When adding the PartialCachingControl to the controls collection
of the parent control, ASP.NET somehow doesn't assign the
PartialCachingControl a unique identifier but re-uses the identifier for
PREVIOUSLY loaded PartialCachingControls.

In addition to the error below, I'm experiencing that the SAME cached output
is displayed for each of the PartialCachingControls in the page (the wrong
identifier is causing this, I'm sure).

Error message returned by ASP.NET: "Multiple controls with the same ID
'_ctl0:_187f384120d0' were found. Trace requires that controls have unique
IDs."

__PAGE ASP.index_aspx
_ctl0 ASP.a_ascx
_ctl0:_ctl2
System.Web.UI.ResourceBasedLiteralControl
_ctl0:BodyArea System.Web.UI.HtmlGenericControl
_ctl0:_ctl0 System.Web.UI.PartialCachingControl
_ctl0:_187f384120d0 ASP.test1_ascx
_ctl0:_187f384120d0:_ctl0 System.Web.UI.Control
_ctl0:_187f384120d0:_ctl1 System.Web.UI.LiteralControl
_ctl0:_ctl1 <- FAILS HERE

Have any of you been trying to do the same behaviour (and come across the
same error)? Any light is very welcome - answer the question and get a car
(well, almost =o))

Thanks in advance.
 
Back
Top