Forums

Skip Navigation LinksHome / Developer Network / Forums / Sitefinity 3.x: 3.x Pre-release forums (retired) > Moving Modules/controls

Moving Modules/controls

  • fregas baratis Intermediate avatar

    Posted on Jan 31, 2007 (permalink)

    I get this error if i go to edit the page after moving or renaming a module or user control.  Its like it sees that i have already used a control with the same name but just a different path to the control.  If i refresh the page, the error goes away but my custom controls do not show up in the control toolbox on the right. 

    I tried deleting & recreating the pages that were using the (old) controls but the error still occurs.

    Thanks for your help,
    Craig


    An item with the same key has already been added.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.ArgumentException: An item with the same key has already been added.

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace:

    [ArgumentException: An item with the same key has already been added.]
       System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) +48
       System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) +2635708
       Telerik.Cms.Web.CmsHelper.get_ToolboxControls() +1413
       Telerik.Cms.Web.UI.Toolbox.CreateChildControls() +693
       System.Web.UI.Control.EnsureChildControls() +87
       System.Web.UI.WebControls.CompositeControl.get_Controls() +12
       Telerik.Cms.Web.CmsHelper.FindContentPlaceHolders(Control control, List`1 list) +99
       Telerik.Cms.Web.CmsHelper.FindContentPlaceHolders(Control control, List`1 list) +160
       Telerik.Cms.Web.CmsHelper.FindContentPlaceHolders(Control control, List`1 list) +160
       Telerik.Cms.Web.CmsHelper.FindContentPlaceHolders(Control control, List`1 list) +160
       Telerik.Cms.Web.EditPage.LoadCmsControls() +386
       Telerik.Cms.Web.EditPage.CreateChildControls() +703
       System.Web.UI.Control.EnsureChildControls() +87
       System.Web.UI.Control.PreRenderRecursiveInternal() +41
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1360
    


    Reply

  • fregas baratis Intermediate avatar

    Posted on Jan 31, 2007 (permalink)

    Never mind.  I was able to resolve this.

    Reply

  • Posted on Feb 5, 2007 (permalink)

    Hello

    I am getting this error a lot, how did you manage to solve this ?

    Reply

  • Posted on Feb 5, 2007 (permalink)

    Hello

    I am getting this error a lot, how did you manage to solve this ?

    Reply

  • fregas baratis Intermediate avatar

    Posted on Feb 5, 2007 (permalink)

    Well, I changed the way i was adding the toolbox items in the Module.  But now I've added another control to the module and I'm getting the error again.  So i'm thoroughly confused now as well.

    Someone please help!

    Reply

  • Rebecca Rebecca admin's avatar

    Posted on Feb 6, 2007 (permalink)

    Hi Fregas,

    Can you please give us detailed description of the steps to reproduce this error? Or, even better, can you send us the project(s) where we can observe this behavior? Just remember to include the database if you are sending project as well.

    Thanks for your cooperation in advance.

    Looking forward to your reply,
    Rebecca
    the telerik team

    Reply

  • fregas baratis Intermediate avatar

    Posted on Feb 6, 2007 (permalink)

    I think its realted to this post:
    http://www.sitefinity.com/support/forums/support-forum-thread/b1043S-ghgbm.aspx

    if you had 4 items or more to a module, you get the error i mentioned, but then if you refresh it goes away and only shows the first 3 modules.  It may not be related to moving modules at all, but i'm not sure...its very sporadic.  I've had a hard time replicating the error, but i would try building some pages using 3 user controls added the toolbox of the module, then add a 4th control to the module, then try to add it to a 4th page and see if you get the error.

    Here is the code i'm using that adds 4 user controls to the module:

    public override ToolboxItemCollection Controls

    {

    get

    {

    if (this.toolBoxItems == null)

    {

    //Register the JobList control for public use.

    string path = "~/CustomControls/ArtistControls/";

    string section = "Artist Gallery";

    this.toolBoxItems = new ToolboxItemCollection(new ToolboxItem[] {

    new CmsToolboxItem(path + "ListArtistCategory.ascx", section, "List Categories", "Displays a list of categories for the artist such as Metalwork, scultpture or leather ."),

    new CmsToolboxItem(path + "GalleryListing.ascx", section, "Artist Galleries", "Displays a list of artist galleries. ."),

    new CmsToolboxItem(path + "ArtistDetail.ascx", section, "Artist Detail", "Displays a single artist's bio and photos of his work."),

    new CmsToolboxItem(path + "ArchiveYears.ascx", section, "Archive", "Displays past archived years of Artist Galleries."),

    }

    );

    }

    return this.toolBoxItems;

    }



    Reply

  • fregas baratis Intermediate avatar

    Posted on Feb 6, 2007 (permalink)

    Not to be a nag, but i really need someone to resolve this as soon as possible.  I noticed it usually takes about one business day for you guys to respond, but this error keeps blocking me from finishing my work and is jeopordizing our project.

    Thanks,
    Craig

    Reply

  • Posted on Feb 6, 2007 (permalink)

    Hi Craig,

    I was able to locate the source of the error. This is a bug in the way the hash code of toolbox items is calculated. The only workaround for now is to keep names and URLs as short as possible.
    Like this:
    new CmsToolboxItem("~/Ctrls/LstCtgrs.ascx", null, "List Categories", null)

    Sorry for the inconvenience this will be fixed for the next release.

    All the best,
    Bob
    the telerik team

    Reply

  • rck avatar

    Posted on Aug 21, 2007 (permalink)

    Hello, we are taking the same error but it changes according to default culture. For example, if we assign  '  en ' as the default culture, we dont take this error, but if we assign ' tr ' as the default culture, we take this error. also we tried your solution but it didnt work. here is the our code that you want us to change : 

    new CmsToolboxItem("~/Isection/a.ascx",null,"CE",null)


    Thanks in advance

    Reply

  • Vlad Vlad admin's avatar

    Posted on Aug 21, 2007 (permalink)

    Hi Recep,

    This bug is fixed in SP2. 

    Also this error most propbobly is caused by duplicated CmsToolboxItems somewhere in your site. Please note that these items could be declared in different modules or in the web.config, i.e:

    Module 1:

    ...
    new CmsToolboxItem("~/Jobs/JobList.ascx", "Jobs", "Job List", "Displays and manages jobs.")
    ...


    Module2:

    ...
    new CmsToolboxItem("~/Jobs/JobList.ascx", "Jobs", "Job List", "Displays and manages jobs.")
    ...


    or in the web.config:

    <telerik>
        <cms>
            <toolboxControls>
                <add name="Job List" section="Jobs" url="~/Jobs/JobList.ascx" description="Displays and manages jobs." />


    Please check this out.

    All the best,
    Vlad
    the telerik team

    Reply

  • Register for webinar
Skip Navigation LinksHome / Developer Network / Forums / Sitefinity 3.x: 3.x Pre-release forums (retired) > Moving Modules/controls