【发布时间】:2015-02-11 07:50:43
【问题描述】:
我的观点是
@model IEnumerable<Trials.ViewModels.PList>
@foreach (var item in Model) {
string target = "";
if (ViewBag.func == "Screening")
{
target = "DivDialogDiv_Scrng";
}
else if (ViewBag.func == "Eligible")
{
target = "DivDialogDiv_Eligible";
}
<tr>
<td>
@Html.DisplayFor(modelItem => item.UnitNo)
</td>
<td>
@Html.DisplayFor(modelItem => item.PName)
</td>
<td>
@Html.DisplayFor(modelItem => item.PAge)
@Html.HiddenFor(x=> item.PAge)
</td>
<td>
@Html.ValueFor(modelItem => item.StartDate, "{0:dd/MM/yyyy}")
</td>
<td>
@Html.ValueFor(modelItem => item.EndDate, "{0:dd/MM/yyyy}")
</td>
<td>
<b>@Ajax.ActionLink("Screen", "getQuestions", "Screening",new AjaxOptions { HttpMethod = "GET", LoadingElementId="divLoading", UpdateTargetId =@target, InsertionMode = InsertionMode.Replace,OnSuccess="openDialog"})</b>
@Html.HiddenFor(modelitem=> item.TId)
@Html.HiddenFor(x=> item.Status_Id)
@Html.HiddenFor(x=> item.UnitNo)
@Html.HiddenFor(x=> item.ResponseID)
</td>
</tr>
}
</tbody>
</table>
在控制器中我接收为
public ActionResult getQuestions(T.ViewModels.PList pl)
{
List<PatientQuestions> model = rep.getQuest(pl.TId,User.Identity.Name);
return PartialView("_getQuestions",model);
}
问题是我在控制器中得到 0 和 null 值。虽然我通过隐藏但仍然在控制器中我没有得到任何从视图传递的值
【问题讨论】:
标签: asp.net-mvc-4 model-view-controller ajaxform