zoukankan      html  css  js  c++  java
  • MVC中使用RadioButtonFor

    1 进行初始化

    <%=Html.RadioButtonFor(model => model.TypeState, 0, new { @id = "radio2", @name = "rdolstState" })%>启用                                                                  
    <%=Html.RadioButtonFor(model => model.TypeState, 1, new { @id = "radio1", @name = "rdolstState",@checked=true })%>禁用

    注意:htmlAbrritbutes属性的使用  “new{…………………………  }”;

    2 编辑时,绑定值,根据数据显示RadioButtonFor选中状态

    <%=Html.RadioButtonFor(model => model.TypeState, 0, new { @id = "radio2", @name = "rdolstState" })%>启用                                                                  
    <%=Html.RadioButtonFor(model => model.TypeState, 1, new { @id = "radio1", @name = "rdolstState" })%>禁用  

    说明:当数据中“TypeState”是0时,这第一条会显示被选中,反之,就是第二条显示选中。

  • 相关阅读:
    一位年轻女董事长的忠告:不想穷下去就请看
    Ajax拓展02
    Ajax拓展
    Ajax概念及基础
    PHP了解01
    CSS3新增功能03
    CSS3新增功能02
    CSS3新增功能01
    html5介绍
    jQuery学习03
  • 原文地址:https://www.cnblogs.com/tinya/p/4521888.html
Copyright © 2011-2022 走看看