컨트롤러에 다시보기에서 전체 모델을 전달 모든 것이 잘있다나는 목록을 가지고
@using ClientDependency.Core.Mvc
@model IEnumerable<TrackingOperaciones.Controllers.Items>
@{
ViewBag.Title = "Ver Items";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<br/>
@using (Html.BeginForm("CargarRecibidos", "Recepcion", FormMethod.Post))
{
<table class="table table-striped table-bordered table-condensed">
<tr>
<th>
Numero
</th>
<th>
Sucursal
</th>
<th>
Area
</th>
<th>
Sector
</th>
</tr>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.Nro_Item)
</td>
<td>
@Html.DisplayFor(modelItem => item.Sucursal.descripcion)
</td>
<td>
@Html.DisplayFor(modelItem => item.Area.descripcion)
</td>
<td>
@Html.DisplayFor(modelItem => item.Sector.Descripcion)
</td>
<td>
@Html.CheckBoxFor(modelItem => item.ID_Estado)
</td>
</tr>
}
</table>
<p>
<input class="btn" name="Guardar" type="submit" value="Guardar"/> |
@Html.ActionLink("Volver al listado de Recepción", "Index")
</p>
}
까지 : 이제 문제는 컨트롤러에서 확인 된 값을 가진 전체 모델을 다시 처리하여 다음과 같이 처리합니다.
[HttpPost]
public ActionResult CargarRecibidos(IEnumerable<Items> items)
{
if (ModelState.IsValid)
{
//do something here
}
return RedirectToAction("Index");
}
}
"항목"포스트 백에 빈 돌아왔다 erably 때문에 내가 해요
는
@using (Html.BeginForm("CargarRecibidos", "Recepcion"))
{
<input class="btn" name="Guardar" type="submit" value="Guardar"/>
}
저를 도와주세요 뭔가 형태 잘못된 것 같다!
좋아, 이제 모든 IEnumerable을하지만, 여전히 같은 문제 : 컨트롤러에서
에만이 체크 박스를 처리하는 데 사용 할 수 있도록 숫자 항목에 바인딩합니다. – Milo브라우저 개발자 도구에서 실제로 게시 된 내용을보고 있습니까? 또한 FormMethod.Post 매개 변수를 Html 양식 도우미에 추가하십시오. –
아니, 크롬을 사용하고 있으며 게시 된 데이터를 보는 방법을 모르겠습니다. – Milo