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