MVC中 Html.RadioButtonFor使用方法,或让数据回显。

View

@Html.RadioButtonFor(Model => Model.Status, 0, new { @id = "Statusradio0", @name = "Status" })正常

@Html.RadioButtonFor(Model => Model.Status, 1, new { @id = "Statusradio1", @name = "Status" })冻结

@Html.RadioButtonFor(Model => Model.Status, 2, new { @id = "Statusradio2", @name = "Status" })隐藏

//0、1、2就相当于存入数据库的值,给它定义的value

Controller

  public ActionResult Index()
       {
           return View(new SettingsViewModel());//如果回显的话,获取数据库的值赋值到页面即可。
       }


你可能感兴趣的:(【Mvc】)