title: access MVC dropdown selected value in the same view
body: <p>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. </p>
  
  <pre><code>&lt;tr&gt;
      &lt;td style="width: 200px; height: 30px"&gt;
          @Html.LabelFor(model =&gt; model.SecurityTypeId)
      &lt;/td&gt;
      &lt;td style="width: 400px; height: 30px"&gt;
          @Html.DropDownListFor(model =&gt; model.SecurityTypeId, Model.SecurityTypes, dropdownHtmlAttrs)
      &lt;/td&gt;
      &lt;td&gt;&amp;nbsp;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
      @if (Model.SecurityTypeId == (int)(SecurityType.Other))
      {
          &lt;td style="width: 200px; height: 30px"&gt;
              @Html.LabelFor(model =&gt; model.Details)
          &lt;/td&gt;
          &lt;td style="width: 400px; height: 30px"&gt;
              @Html.TextAreaFor(model =&gt; model.Details, new { Style = "width:240px" })
          &lt;/td&gt;
          &lt;td&gt;&amp;nbsp;&lt;/td&gt;
      }
  &lt;/tr&gt; 
  </code></pre>