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

Discussion in 'ASP .Net' started by Anders Borum, Nov 26, 2003.

  1. Anders Borum

    Anders Borum Guest

    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.
     
    Anders Borum, Nov 26, 2003
    #1
    1. Advertisements

  2. Anders Borum

    Anders Borum Guest

    Anders Borum, Nov 26, 2003
    #2
    1. Advertisements

  3. Anders Borum

    Anders Borum Guest

    Anders Borum, Nov 26, 2003
    #3
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.