Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-mvc/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 模型绑定到列表-如何处理插入_C#_Asp.net Mvc_Asp.net Mvc 2_List_Binding - Fatal编程技术网

C# 模型绑定到列表-如何处理插入

C# 模型绑定到列表-如何处理插入,c#,asp.net-mvc,asp.net-mvc-2,list,binding,C#,Asp.net Mvc,Asp.net Mvc 2,List,Binding,我指的是Phil Haack的这篇文章,我需要做同样的事情,但是如果我需要在列表中插入记录,在我想要的任何索引处呢?在不使用Javascript和更新所有索引的情况下,如何保持索引的同步 <form method="post" action="/Home/Create"> <input type="text" name="[0].Title" value="Curious George" /> <input type="text" name="[0].Author

我指的是Phil Haack的这篇文章,我需要做同样的事情,但是如果我需要在列表中插入记录,在我想要的任何索引处呢?在不使用Javascript和更新所有索引的情况下,如何保持索引的同步

<form method="post" action="/Home/Create">

<input type="text" name="[0].Title" value="Curious George" />
<input type="text" name="[0].Author" value="H.A. Rey" />
<input type="text" name="[0].DatePublished" value="2/23/1973" />

<input type="text" name="[1].Title" value="Code Complete" />
<input type="text" name="[1].Author" value="Steve McConnell" />
<input type="text" name="[1].DatePublished" value="6/9/2004" />
<!-- I want to insert a record here by adding the fields through JavaScript -->
<input type="text" name="[2].Title" value="The Two Towers" />
<input type="text" name="[2].Author" value="JRR Tolkien" />
<input type="text" name="[2].DatePublished" value="6/1/2005" />

<input type="submit" />

我不太明白我将如何使用那篇博文中描述的“非顺序索引”来做一些事情,比如将记录插入到特定的索引中

有什么想法吗