本文介绍了已存在具有相同密钥的条目。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

运行应用程序时出现以下错误...



在此页面中,我将动态添加到表中的行和包含下拉列表的行,每个控件具有不同ID的文本框和必填字段验证器。



I am getting the below error while running the application ...

In this page I am adding rows dynamically to a table and the rows containing dropdown list,text boxes and required field validator with different ID for each control.

Server Error in '/' Application.
--------------------------------------------------------------------------------

An entry with the same key already exists.
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 entry with the same key already exists.

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 entry with the same key already exists.]
   System.Collections.Specialized.ListDictionary.Add(Object key, Object value) +6241213
   System.Web.UI.ClientScriptManager.RegisterExpandoAttribute(String controlId, String attributeName, String attributeValue, Boolean encode) +272
   System.Web.UI.ScriptRegistrationManager.RegisterExpandoAttribute(Control control, String controlId, String attributeName, String attributeValue, Boolean encode) +115
   System.Web.UI.ScriptManager.RegisterExpandoAttribute(Control control, String controlId, String attributeName, String attributeValue, Boolean encode) +44

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner) +0
   System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner) +72
   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +251
   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +28
   System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams) +2377
   System.Web.UI.WebControls.ValidatorCompatibilityHelper.RegisterExpandoAttribute(Control control, String controlId, String attributeName, String attributeValue, Boolean encode) +170
   System.Web.UI.WebControls.BaseValidator.AddAttributesToRender(HtmlTextWriter writer) +330
   System.Web.UI.WebControls.RequiredFieldValidator.AddAttributesToRender(HtmlTextWriter writer) +18
   System.Web.UI.WebControls.WebControl.RenderBeginTag(HtmlTextWriter writer) +20
   System.Web.UI.WebControls.BaseValidator.Render(HtmlTextWriter writer) +445
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +208
   System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
   System.Web.UI.WebControls.TableCell.RenderContents(HtmlTextWriter writer) +57
   System.Web.UI.WebControls.WebControl.Render(HtmlTextWriter writer) +32
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27

推荐答案


这篇关于已存在具有相同密钥的条目。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 03:13