title: Render ASP.NET MVC partial view based on a condition on client side
body: <p>In our ASP.NET MVC 4 app, we have four partial views: View1, View2, View3, View4. When user selects a number, say, 2, from a dropdown and click on a submit button we want to render only partial views View2. Likewise, when 3 is selected we want to render View3 and so on. I tried the following but it does not render View2. I assume we cannot do this from inside script tag.</p>
  
  <pre><code>&lt;div id="v2"&gt;
      &lt;script&gt;
          if (n==2) {
              @{Html.RenderPartial("View2");}
          }
      &lt;/script&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>How can we achieve the above?</p>