Services Partners Company
Knowledge Base


Article

An item with the same key has already been added

« Go Back

Information

 
EnvironmentProduct: Sitefinity
Version: 5.x, 6.x, 7.x, 8.x, 9.x, 10.x
OS: All supported OS versions
Database: All supported Microsoft SQL Server versions
Question/Problem Description
An item with the same key has already been added error appears when submitting a form.

Server Error in '/' Application. 

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) +56 
System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) +13737545 
Telerik.Sitefinity.Modules.Forms.Web.FormsHelper.GetFormPostedData(IEnumerable`1 controls) +1177 
Telerik.Sitefinity.Modules.Forms.Web.UI.FormsControl.CreateFormValidatingEvent(IFormEntryResponseEditContext formEntryResponseEditContext, IList`1 controlsSate) +33 
Telerik.Sitefinity.Modules.Forms.Web.UI.FormsControl.ProcessFormSaving() +305 
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +11762653 
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +150 
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6016
Steps to Reproduce
Clarifying Information
Error MessageAn item with the same key has already been added.
Defect/Enhancement Number
Cause
Two of the input fields have identical FieldName for their meta field property.
Resolution
1. Check each field for their meta field FieldName.
    - for Web Forms: Edit > Advanced > MetaField > FieldName
    - for MVC: Edit > Advanced > Model > MetaField > FieldName
2. Once the input fields with identical FieldName are identified remove one of them and replace it with new one.
3. Save changes

Note: By removing an input field, all previous data for that field will be removed from the database.
Workaround
Notes
Attachment 
Last Modified Date6/19/2017 6:33 AM
Disclaimer

The origins of the information on this site may be internal or external to Progress Software Corporation (“Progress”). Progress Software Corporation makes all reasonable efforts to verify this information. However, the information provided is for your information only. Progress Software Corporation makes no explicit or implied claims to the validity of this information.

Any sample code provided on this site is not supported under any Progress support program or service. The sample code is provided on an "AS IS" basis. Progress makes no warranties, express or implied, and disclaims all implied warranties including, without limitation, the implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample code is borne by the user. In no event shall Progress, its employees, or anyone else involved in the creation, production, or delivery of the code be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample code, even if Progress has been advised of the possibility of such damages.



Feedback
 
Was this article helpful?

   

Your feedback is appreciated.

Please tell us how we can make this article more useful.



Characters Remaining: 255