0

单击删除链接(这是一个按钮)没有任何反应。我的意思是没有发布表格。不确定为什么会发生。

@foreach (var item in Model) {
<tr>
    <td>
        @Html.DisplayFor(modelItem => item.RegistrationNo)
    </td>
    <td>
        @Html.DisplayFor(modelItem => item.FirstName)
    </td>
    <td>
        @Html.DisplayFor(modelItem => item.MiddleName)
    </td>
    <td>
        @Html.DisplayFor(modelItem => item.LastName)
    </td>
    <td>
        @Html.DisplayFor(modelItem => item.DateofBirth)
    </td>
    <td>
        @Html.ActionLink("Edit", "Edit", new { id=item.Id }) |
        @Html.ActionLink("Details", "Details", new { id=item.Id }) |
       <input type="submit" value="Delete" name="Delete" style="border: none; background: none; 
            text-decoration: underline; cursor: pointer;"> 
    </td>
</tr>
4

1 回答 1

1

这是你可以尝试的

@using (Html.BeginForm()) {
<table>

@foreach (var item in Model) {
<tr>
    <td>
        @Html.DisplayFor(modelItem => item.RegistrationNo)
        @Html.HiddenFor(modelItem => item.RegistrationNo)
    </td>
    <td>
        @Html.DisplayFor(modelItem => item.FirstName)
        @Html.HiddenFor(modelItem => item.FirstName)
    </td>
    <td>
        @Html.DisplayFor(modelItem => item.MiddleName)
        @Html.HiddenFor(modelItem => item.MiddleName)
    </td>
    <td>
        @Html.DisplayFor(modelItem => item.LastName)
        @Html.HiddenFor(modelItem => item.LastName)
    </td>
    <td>
        @Html.DisplayFor(modelItem => item.DateofBirth)
        @Html.HiddenFor(modelItem => item.DateofBirth)
    </td>
    <td>
        @Html.ActionLink("Edit", "Edit", new { id=item.Id }) |
        @Html.ActionLink("Details", "Details", new { id=item.Id }) |
       <input type="submit" value="Delete" name="Delete" style="border: none; background: none; 
            text-decoration: underline; cursor: pointer;"> 
    </td>
</tr>


</table>


}
于 2012-09-09T12:36:20.757 回答