我的视图似乎没有到达我的控制器,我在视图中填充了一个选择循环模型然后我尝试使用新信息调用部分视图
我的HomeController.cs
有这种方法:
[HttpPost]
public ActionResult BusquedaDeSensores(int id)
{
ViewBag.Message = "text...";
retail2Entities cl = new retail2Entities();
List<GetSensorByClient_Result> sensores = cl.GetSensorByClient(id,0).ToList();
return PartialView("_BusquedaDeSensores",sensores);
}
这是我在索引页面上预加载一些数据并尝试将所选值发送给我的控制器。
<ol class="round">
<li class="one">
@using (Ajax.BeginForm("BusquedaDeSensores", "Home", new AjaxOptions { InsertionMode = InsertionMode.Replace, HttpMethod = "Post", UpdateTargetId = "busquedaDeSensores" }))
{
<select id="Cientes" name="Clientes">
@foreach (var item in Model)
{
<option value="@item.idClient">@item.name</option>
}
</select>
<input type="submit" value="submit" />
}
</li>
<li id="busquedaDeSensores "class="two">
lel
</li>
这将是我的部分视图_BusquedaDeSensores
:
@model IEnumerable< Recnons.Models.GetSensorByClient_Result>
@using (Ajax.BeginForm("EntradaSalida", "Home", new AjaxOptions { InsertionMode = InsertionMode.Replace, HttpMethod = "Post", LoadingElementId = "ajax-loader", UpdateTargetId = "entradaSalida" }))
{
<select id="Sensores" name="Sensores">
@foreach (var item in Model)
{
<option value="@item.Id">@item.Id</option>
}
</select>
<input type="submit" value="submit" />