• 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时,这第一条会显示被选中,反之,就是第二条显示选中。

  • 相关阅读:
    微擎使用函数获取用户微信信息
    xshell连接不上linux情况一
    destoon手机端分页
    kvm安装win2012
    kvm安装ubuntu
    KVM的磁盘管理相关
    ubuntu的iptables
    kvm安装win2003
    Centos-6.4 安装mysql-5.5.14
    CentOS 6.4安装bind-9.8.2最新版(DNS服务器)
  • 原文地址:https://www.cnblogs.com/xiaonanmu/p/MVC_RadioButtonFor.html
Copyright © 2020-2023  润新知