我需要将从这些Radioboxes中选择的值传递到“List”视图
cshtml文件
@Html.RadioButtonFor(m => m.SmokeHouse, 1)
@Html.RadioButtonFor(m => m.SmokeHouse, 0)
@Html.RadioButtonFor(m => m.SmokeCar, 1)
@Html.RadioButtonFor(m => m.SmokeCar, 0)
@Html.RadioButtonFor(m => m.SmokeWork, 1)
@Html.RadioButtonFor(m => m.SmokeWork, 0)
[HttpPost]
public ViewResult SmokingEnvironments()
{
return View("List");
}
类
public class Screen
{
public int SmokeCar { get; set; }
public int SmokeHouse { get; set; }
public int SmokeWork { get; set; }
}
答案 0 :(得分:1)
假设您有一个发布到该操作的提交按钮,您只需要更新控制器以将模型作为参数并将其传递给下一个视图:
[HttpPost]
public ViewResult SmokingEnvironments(Screen model)
{
return View("List", model);
}