Translate

2014年3月7日 星期五

MVC RadioButton

RadioButton like this:

only one of predefined set of options

ex.

.cshtml [View]

        @Html.RadioButton("food", "steak", true)
            steak
        @Html.RadioButton("food", "hamburger", false)
            humbuger
        @Html.RadioButton("food", "pasta", false)
            pasta


.cs [Controller]

//string food will be selected steak or hamburger or pasta
ActionResult EditMenu(string id, string food)
{
  return View();
}

沒有留言:

張貼留言