2012-04-27 74 views
1

在我的编辑视图中,我可以保留字段的值,但单选按钮。 像闻一选择网格行,然后单击编辑它给了我先前保存的值都超视距雷达场BT不是单选按钮如何在编辑视图中显示选中的单选按钮mvc3

我怎样才能设置这些值 LIK如果保存的数据包含性别为F的值,则

if(gender='f') 
{ 
    <input type="radio" name="forwhom" value="f" checked="checked"></input> 
} 
else 
    <input type="radio" name="forwhom" value="m" checked="checked"></input> 

我使用2点部分意见如下

我一定要为它编写任何AJAX显示我的数据? 请帮忙 关注!!!

回答

-1

或尝试。

if(gender = 'f') 
{ 
    @Html.RadioButtonFor(x => x.Gender, "radioValue", new { @checked = "true"}) 
} 
else 
{ 
    @Html.RadioButtonFor(x => x.Gender, "radioValue", new {@checked = "true"})  
} 

希望能帮到你..谢谢。

相关问题