@HTML.RadioButtonFor和@Html.DropDownList用法

[email protected]用法很简单

 <label class="radio radio-inline">@Html.RadioButton("State", 1, Model.State == 1) 可用</label>

 <label class="radio radio-inline">@Html.RadioButton("State", 0, Model.State == 0) 禁用</label>

2.  @Html.DropDownList用法

@Html.DropDownList("ChannelID", ViewData["ChannelID"] as SelectList, new { @class = "form-control" })

后台写法

   List<ChannelInfo> list = new ChannelManager().Filter(m=>m.State==1).ToList();
ViewData[
"ChannelID"] = new SelectList(list, "ChannelID", "RealName");

 

你可能感兴趣的:(@HTML.RadioButtonFor和@Html.DropDownList用法)