0
为什么在顶部添加BeginForm标签显示Edit and Details部分旁边的“Delete”按钮?附上代码和图片。为什么html helper开始格式化显示的方式
@foreach (var item in Model)
{
using (Html.BeginForm("Delete", "Employee", new { id = item.EmployeeID}))
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.Name)
</td>
<td>
@Html.DisplayFor(modelItem => item.Gender)
</td>
<td>
@Html.DisplayFor(modelItem => item.City)
</td>
<td>
@Html.DisplayFor(modelItem => item.DepartmentID)
</td>
<td>
@Html.DisplayFor(modelItem => item.DateOfBirth)
</td>
<td>
@Html.ActionLink("Edit", "Edit", new { id = item.EmployeeID }) |
@Html.ActionLink("Details", "Details", new { id = item.EmployeeID }) |
<input type="submit" value="Delete"
onclick="return confirm('Are you sure you want to delete user @item.Name');" />
</td>
</tr>
}
}
因为'input type =“submit”'是一个按钮,而不是'edit'这样的链接。添加一个类到你的输入并创建一个css样式,让它看起来如何。 – DLeh 2015-04-01 20:30:32