每当我提交表单时,我都会收到这个错误,而且 action 方法也没有被调用,因为:
已添加具有相同键的项。
还有例外的细节:
[ ArgumentException: 具有 已经添加了相同的密钥。]
System.ThrowHelper.ThrowArgumentException (ExceptionResource + 52
系统。集合。通用。字典‘2。插入(TKey 键、 TValue 值、 Boolean add) + 9382923 System. Linq. Enumerable.ToDictionary (IEnumable‘1 源代码,Func‘2 keySelector,Func‘2 ElementSelector,IEqualityComparer‘1 + 252
System.Linq.Enumerable.ToDictionary (IEnumerable‘1 来源,Func‘2 keySelector, 比较器’1比较器) + 91
System.Web.Mvc.ModelBindingContext.get _ PropertyMetadata () + 228 System. Web.Mvc.DefaultModelBinder.BindProperty (ControllerContext 模型绑定上下文 BindingContext,PropertyDescriptor PropertyDescriptor) + 392
DefaultModelBinder.BindProperties (ControllerContext 模型绑定上下文 + 147
DefaultModelBinder.BindComplexElementalModel (ControllerContext 模型绑定上下文 BindingContext,对象模型) + 98
DefaultModelBinder.BindComplexModel (ControllerContext 模型绑定上下文 + 2504
DefaultModelBinder.BindModel (ControllerContext 模型绑定上下文 + 548
System.Web.Mvc.ControllerActionInvoker 参数描述符 参数描述符) + 473
System.Web.Mvc.ControllerActionInvoker 控制器上下文,动作描述符 ActionDescriptor) + 181
System.Web.Mvc.ControllerActionInvoker.InvokeAction (ControllerContext 控制器上下文,字符串操作名称) + 830 System. Web. Mvc. Controller. ExecuteCore () + 136 System. Web.Mvc.ControllerBase. Execute (RequestContext RequestContext) + 111
System.Web.Mvc.ControllerBase. System.Web.Mvc.IController. Execute (RequestContext RequestContext) + 39
System.Web.Mvc. < > c _ _ DisplayClass8.b _ _ 4() + 65 System. Web.Mvc.Async. < > c _ _ DisplayClass1.b _ _ 0() + 44 System. Web.Mvc.Async. < > c _ _ DisplayClass8‘1.b _ _ 7(IAsyncResult + 42 System. Web.Mvc.Async. WrappedAsyncResult‘1. End () + 141 System. Web.Mvc.Async. AsyncResultWrapper. End (IAsyncResult Object 标记) + 54
系统。 Web。 Mvc.Async.AsyncResultWrapper. End (IAsyncResult Object 标记) + 40
System.Web.Mvc.MvcHandler. EndProcessRequest (IAsyncResult + 52
System.Web.IHttpAsyncHandler. EndProcessRequest (IAsyncResult 结果) + 38
System.Web.CallHandlerExectionStep.System.Web.HttpApplication.IExectionStep.Execute () + 8836913 System. Web.HttpApplication.ExecuteStep (IExectionStep 步骤、布尔值及同步完成) + 184
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/XYZ.Master"
Inherits="System.Web.Mvc.ViewPage<XYZ.Models.Admin.AdminSegmentCommissionsModel>" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
Create
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<% using (Html.BeginForm()) {%>
<div class="box3">
<div class="userinfo">
<h3>Admin Segment Commissions</h3>
</div>
<div class="buttons-panel">
<ul>
<li>
<input type="submit" value="Save" class="save" />
</li>
<li>
<%:Html.ActionLink("Cancel", "Index", new { controller = "AdminSegmentCommissions" }, new { @class = "cancel" })%>
<%--<input type="button" value="Cancel" class="cancel" onclick="document.location.href='/AirlineLedgerTransactionReceiver/Index'" />--%>
</li>
</ul>
</div>
</div>
<div class="row-1">
<div class="form-box1 round-corner">
<div class="form-box1-row">
<div class="form-box1-row-content float-left">
<div>
<label>
<%: Html.LabelFor(model => model.FromSegmentNumber) %></label>
<%: Html.TextBoxFor(model => model.FromSegmentNumber) %>
<%: Html.ValidationMessageFor(model => model.FromSegmentNumber) %>
</div>
</div>
</div>
</div>
</div>
<%} %>