-1
這是我用過的RadioButton
代碼:MVC單選按鈕總是傳遞假值
@Html.RadioButtonFor(model => model.A, new { @class = "radio-inline", @checked = "checked", id = "A" }, "Indicator")
@Html.Label("Active")
@Html.RadioButtonFor(model => model.A, new { @class = "radio-inline", @checked = "checked", id = "B" }, "Indicator")
@Html.Label("InActive")
這是模態
private bool a;
public bool A
{
get
{
return a;
}
set
{
a= value;
}
}
你是什麼型號?你沒有給單選按鈕一個值,所以他們不會發布任何東西(並看看你的代碼生成的HTML) –
在這兩種情況下你使用model => model.A –
得到了一些錯誤,編號爲:( –