私は、Razor ViewにDropDownListとTextAreaを持っています。ドロップダウン内の特定の値が選択されている場合にのみ、TextAreaが表示されるようにします。それにはどんな解決策がありますか?これまで私が試したことはありますが、Security型の値が設定されていると仮定しているため、正しくありません。同じビューのMVCドロップダウン選択値
<tr>
<td style="width: 200px; height: 30px">
@Html.LabelFor(model => model.SecurityTypeId)
</td>
<td style="width: 400px; height: 30px">
@Html.DropDownListFor(model => model.SecurityTypeId, Model.SecurityTypes, dropdownHtmlAttrs)
</td>
<td> </td>
</tr>
<tr>
@if (Model.SecurityTypeId == (int)(SecurityType.Other))
{
<td style="width: 200px; height: 30px">
@Html.LabelFor(model => model.Details)
</td>
<td style="width: 400px; height: 30px">
@Html.TextAreaFor(model => model.Details, new { Style = "width:240px" })
</td>
<td> </td>
}
</tr>
あなたは、クライアント側のイベントに応答する場合は、ジャバスクリプト/ jqueryのを必要としています。 –