Asp.net mvc 5 在MVC中编辑视图页面或index.cshtml
我在应用程序中首先使用MVC5和EntityFramework6数据库。 我需要更新查看页面\index.cshtml中的值字段。 是否可以使用@Html.EditorFor在单击单个按钮时编辑每个项目的值字段? 下面是index.cshtml中的代码Asp.net mvc 5 在MVC中编辑视图页面或index.cshtml,asp.net-mvc-5,Asp.net Mvc 5,我在应用程序中首先使用MVC5和EntityFramework6数据库。 我需要更新查看页面\index.cshtml中的值字段。 是否可以使用@Html.EditorFor在单击单个按钮时编辑每个项目的值字段? 下面是index.cshtml中的代码 <table> <tr> <th> Number </th> <th> Name
<table>
<tr>
<th>
Number
</th>
<th>
Name
</th>
<th>
Value
</th>
<th>
Description
</th>
</tr>
foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.number)
</td>
<td>
@Html.DisplayFor(modelItem => item.name)
</td>
<td>
@Html.EditorFor(modelItem => item.value)
@*@Html.ValidationMessageFor(modelItem => item.value) *@
</td>
<td>
@Html.DisplayFor(modelItem => item.description)
</td>
@* <td>
@Html.ActionLink("Edit", "Edit", new { id=item.id })
</td>*@
</tr>
</table>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Save" class="btn btn-default" />
</div>
</div>
单击“保存”按钮时,我应该更新任意行数的值字段中的数据。
它首先在数据库中完成,因此编辑、查看和详细信息的操作包含在控制器中。您必须将所有内容都放在一个文件夹中,才能将详细信息发布到服务器,然后您可以管理发布的元素。您将发布一个ITEN列表。也许这会帮助你: