C# 发布列表中缺少编号的列表

C# 发布列表中缺少编号的列表,c#,asp.net-mvc-4,post,C#,Asp.net Mvc 4,Post,我有一个表格,可以用来发布信息列表 所以清单可以是这样的 Person[0].FullName Person[0].Address Person[1].FullName Person[1].Address Person[2].FullName Person[2].Address Person[3].FullName Person[3].Address 当我发布这些信息并运行我的更新注释时,一切正常。列表模型返回4条记录 但是,当我使用jQuery删除中间记录之一时,它会从HTML中删除整

我有一个表格,可以用来发布信息列表

所以清单可以是这样的

Person[0].FullName
Person[0].Address

Person[1].FullName
Person[1].Address

Person[2].FullName
Person[2].Address

Person[3].FullName
Person[3].Address
当我发布这些信息并运行我的更新注释时,一切正常。列表模型返回4条记录

但是,当我使用jQuery删除中间记录之一时,它会从HTML中删除整行内容。因此,我以下面的场景作为结束

Person[0].FullName
Person[0].Address

Person[2].FullName
Person[2].Address

Person[3].FullName
Person[3].Address
但是现在当我发布信息时,列表计数现在是1,因为它忽略了删除后的所有内容。我猜这是因为列表现在不是连续的

以前有没有人遇到过同样的问题,并且知道保存所有项目的方法

谢谢

编辑-HTML

for (int i = 0; i < Model.PersonsViewModel.Count(); i++)
{
    <div id="clone_@i" class="form-group clone">
        <div class="col-sm-6 has-feedback">
            <div class="row">
                <div class="col-sm-12">
                    @Html.TextBoxFor(model => model.PersonsViewModel[i].FullName, new { @class = "form-control" })
                    @Html.ValidationMessageFor(m => m.PersonsViewModel[i].FullName)
                </div>
            </div>
        </div>
        <div class="col-sm-6 has-feedback">
            <div class="row">
                <div class="col-sm-12">
                    @Html.TextBoxFor(model => model.PersonsViewModel[i].Address, new { @class = "form-control" })
                    @Html.ValidationMessageFor(m => m.PersonsViewModel[i].Address)
                </div>
            </div>
        </div>  
    </div>
}
for(int i=0;imodel.PersonViewModel[i].FullName,新的{@class=“form control”})
@Html.ValidationMessageFor(m=>m.PersonsViewModel[i].FullName)
@Html.TextBoxFor(model=>model.PersonViewModel[i]。地址,新的{@class=“form control”})
@Html.ValidationMessageFor(m=>m.PersonsViewModel[i]。地址)
}

因为您正在破坏列表链,并且它丢失了列表的索引。也许您可以尝试控制器端编辑。我以前遇到过这个问题,并在控制器中修复了它。

当表单发布到控制器时,它已经丢失了模型中的项。