我目前正在开发中MVC2 申请我已经想用在我的应用 多发的形式标记在我看来 我创建了具有删除选项表我正在通过邮政进行个人删除,所以我已为每个按钮创建表单标签。 我也希望用户给出选项删除多条记录,所以我给他们提供了复选框。这个表单应该具有复选框和所有的值。 这样的形式得到呈现像这样我可以有另一种内一种形式标记在ASP.net MVC RC2
对于每一个删除按钮
<form action="/Home/MutipleDelete" method="post">
<input class="button " name="Compare" type="submit" value="Mutipledelete" style="margin-right:132px;" />
<input id="chk1" name="chk1" type="checkbox" value="true" />
<form action="/Home/Delete" method="post">
<input type="submit" class="submitLink" value="member1" />
<input type="hidden" name="hfmem1" id="hfmem1" value="1" />
</form>
<input id="chk2" name="chk2" type="checkbox" value="true" />
<form action="/Home/Delete" method="post">
<input type="submit" class="submitLink" value="member2" />
<input type="hidden" name="hfmem2" id="hfmem2" value="2" />
</form>
</form>
下是行不通的。但如果我写我的代码的形式呈现这样
<form action="/Home/MutipleDelete" method="post">
<input class="button " name="Compare" type="submit" value="Mutipledelete" style="margin-right:132px;" />
</form>
<input id="chk1" name="chk1" type="checkbox" value="true" />
<form action="/Home/Delete" method="post">
<input type="submit" class="submitLink" value="member1" />
<input type="hidden" name="hfmem1" id="hfmem1" value="1" />
</form>
<input id="chk2" name="chk2" type="checkbox" value="true" />
<form action="/Home/Delete" method="post">
<input type="submit" class="submitLink" value="member2" />
<input type="hidden" name="hfmem2" id="hfmem2" value="2" />
</form>
它是在Mozilla,但不是在IE.I已经调试并检查值的FormCollection在contoller.What做的工作?
但使用与get方法删除不是一个好主意也是由斯蒂芬·瓦尔特http://stephenwalther.com/blog/archive/2009/01提/ 21/asp.net-mvc-tip-46-ndash-donrsquot-use-delete-links-because.aspx – coolguy97 2010-03-06 11:26:12
好的,这是一个公平点。在这种情况下,我认为你需要做出最重要的决定(如果Javascript被关闭,最不可能错过)功能:单独删除或选择删除。最重要的一个使用表单,另一个使用Ajax。 – pdr 2010-03-06 12:06:06