私は RAZOR を初めて使用します。ユーザーが RadioButton をクリックしたときにイベントをトリガーしたいと考えています。
理想的には、ユーザーが RadioButton をクリックした後、選択された値を動的に表示する必要があります。
質問:
選択した値を取得する方法
ユーザーが RadioButton をクリックしたときにイベントをトリガーする方法。
@{ Layout = "~/_SiteLayout.cshtml"; Page.Title = "Contact"; } <div> <table> <tr> <td> @Html.RadioButton("Gender", "Male", true) Male </td> <td> @Html.RadioButton("Gender", "Female", false) Female </td> </tr> </table> @Html.Label(Request["Gender"] == null ? "No Selection" : Request["Gender"])