保罗,我不得不换一种方式:从文本框onChange
,设置单选值。
看一下这个:
@model string
<!DOCTYPE html>
<html>
<head>
<title>ViewA</title>
<script type="text/javascript">
function changeRadioValue(newValue) {
var radio = document.getElementById('idRadio');
if (radio != null) {
radio.value = newValue;
}
else {
//do nothing?
}
}
</script>
</head>
<body>
<div>
@Html.TextBox("theTextBox", Model, new { id = Model, onChange = "changeRadioValue(this.value)" })
@Html.RadioButton("radio", "Default radio value", new { id = "idRadio", onClick="alert(this.value)" })
</div>
</body>
</html>
收音机onClick
仅用于调试。
希望这可以帮助
问候