I have a DropDownList and a TextArea in a Razor View. I want the TextArea to be visible only if specific value in the drop down has been selected. what solution is there to do that? Here is what I have tried so far but it is not quite right because it assumes the value of Security type is set.
<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>