ラジオ ボタンのグループをモデルの値にバインドしようとしています。通常、これは簡単に実行できますが、このように機能するように少し変更しようとしています。 IsEventsRegistration
は Int であり、可能な選択肢は 0 ~ 5 です。最初に 3 つのラジオ ボタンをユーザーに表示する必要があります。
0 の場合IsEventsRegistration
- 最初のラジオ ボタンを選択
1 の場合IsEventsRegistration
- 2 番目のラジオ ボタンを選択
> 1 の場合IsEventsRegistration
- 3 番目のラジオ ボタンを選択します
すると、jquery で非表示になっていた 4 つのラジオ ボタンの別のグループが表示されます。jQuery を使用して、ラジオ グループの表示と非表示をうまく処理できます。私の問題は-これらのラジオボタンを作成の値にバインドする方法があるIsEventsRegistration
ので、値が >1 の場合、ラジオ2 Or 3 Or 4 Or 5
がチェックされ、正しいラジオがチェックされますか?
@Html.RadioButtonFor(Function(x) x.IsEventsRegistration , 0) <a>...</a><br />
@Html.RadioButtonFor(Function(x) x.IsEventsRegistration , 1) <a>...</a><br />
@Html.RadioButtonFor(Function(x) x.IsEventsRegistration, 2 Or 3 Or 4 Or 5) <a>...</a><br />
<div class="hideRadios">
@Html.RadioButtonFor(Function(x) x.IsEventsRegistration , 2) <a>...</a><br />
@Html.RadioButtonFor(Function(x) x.IsEventsRegistration , 3) <a>...</a><br />
@Html.RadioButtonFor(Function(x) x.IsEventsRegistration , 4) <a>...</a><br />
@Html.RadioButtonFor(Function(x) x.IsEventsRegistration , 5) <a>...</a><br />
</div>
これは VB.Net ですが、ac# の回答も同様に優れています