2012-04-27 71 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"})  
} 

希望能幫到你..謝謝。

相關問題