MVC中使用RadioButtonFor
2016-01-18 10:24
281 查看
http://shw3588.blog.163.com/blog/static/6507576201321395845538/
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时,这第一条会显示被选中,反之,就是第二条显示选中。
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时,这第一条会显示被选中,反之,就是第二条显示选中。
相关文章推荐
- UVA 1424 - Salesmen 刘汝佳的动归练习 ★★★
- 2016年1月中国域名商解析量14强:排名变动大
- 如何在 Ubuntu/Fedora/Debian 中安装 GitLab
- 如何在 Ubuntu/Fedora/Debian 中安装 GitLab
- 读配置文件
- 广电双向网
- phpbb简体中文语言包的安装
- .net中单选按钮RadioButton,RadioButtonList 以及纯Html中radio的用法实例?
- 在ASP.NET中基于Owin OAuth使用Client Credentials Grant授权发放Token
- 关于ztree创建
- 学习笔记—解析XML
- MyEclipse中改变.jsp默认的设计图模式为jsp editor
- #ifdef _DEBUG #undef THIS_FILE static char THIS_FILE[]=__FILE__; #define new DEBUG_NEW #endif
- 构建工具之---ant
- 配置https双向认证过程实战(tomcat和浏览器交互)
- EJB基础二 异步调用
- JavaMail发送邮件时常见错误
- Windows Server 2008 R2 /2012 修改密码策略
- jquery插件库
- 我们终将成为我们嘲笑的人