MVC 4.0中编辑模式下的Radion按钮控件 [英] Radion button control in edit mode in MVC 4.0

查看:101
本文介绍了MVC 4.0中编辑模式下的Radion按钮控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我在页面上有两个单选按钮(正确和错误)。

我可以得到零值或者数据库中有1个。

当我得到值1时,应检查True单选按钮,否则应检查False。

我怎样才能实现此功能在MVC 4.0中?

请给出你的建议。



谢谢,



问候,

Ashish

解决方案

CSHTML代码:

------ ------


@ Html.RadioButtonFor(model => model.trueFalseAnswer,true,new {id =TrueFalseAnswer_true})

真的


@ Html.RadioButtonFor(model => model.trueFalseAnswer,false,new {id =TrueFalseAnswer_false})

False

Hi,

I have two radio buttons(True and False) on a page.
I could get the value Zero or 1 from the database.
When I get the value 1 then "True" radio button should be checked otherwise "False" should be checked.
How could I achieve this functionality in MVC 4.0?
Please give your suggestions.

Thank you,

Regards,
Ashish

解决方案

CSHTML Code:
------------

@Html.RadioButtonFor(model => model.trueFalseAnswer, true, new { id = "TrueFalseAnswer_true" })
True

@Html.RadioButtonFor(model => model.trueFalseAnswer, false, new { id = "TrueFalseAnswer_false" })
False


这篇关于MVC 4.0中编辑模式下的Radion按钮控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆