草庐IT

radiobuttonfor

全部标签

javascript - 我如何从 jquery 中的 html.radiobuttonfor 中获取选定的值

我在MVC中有2个单选按钮绑定(bind)到一个模型,如下所示。我如何在jquery中获取选定的单选按钮值?Yes@Html.RadioButtonFor(m=>m.SelectedPerson.is_selected,true,new{@onchange="ToggleInfo();"})No@Html.RadioButtonFor(m=>m.SelectedPerson.is_selected,false,new{@onchange="ToggleInfo();"})被调用的javascript函数是:functionToggleInfo(){//Gettheselectedval

c# - Mvc Razor 语法中的 RadiobuttonFor

我有三个单选按钮,我的字段值类型是整数,例如Maintenance为3,1人活跃,2人不活跃。@Html.RadioButtonFor(model=>model.StatusId,"3")Maintenance@if(Model.IsReady==true){@Html.RadioButtonFor(model=>model.StatusId,"1")Active}@Html.RadioButtonFor(model=>model.StatusId,"2")Inactive我使用上面的代码然后正确地插入数据但是当我的表单在编辑模式下打开时我没有选择任何单选按钮。我也使用了下面的代码但没