title: MVC3 Razor - Javascript statements with nested server ifs
body: <p>Why doesn't the razor template engine like:</p>
  
  <pre><code>@if (Model.ActionComplete) {
    &lt;script type="text/javascript"&gt;
  
        @if (Model.Message.IsString()) {
  
        }
  
    &lt;/script&gt;
  }
  </code></pre>
  
  <p>It is complaining that the <code>Model</code> in <code>Model.Message</code> should be a constant and that the <code>&lt;/script&gt;</code> tag is missing an @end statement.</p>
  
  <p>I am trying to get to:</p>
  
  <pre><code>@if (Model.ActionComplete) {
    &lt;script type="text/javascript"&gt;
      $(document).ready(function () {
        $("#user-form").slideUp();
        @if (Model.Message.IsString()) {
          @:showMessageBar("@(Model.Message)");
        }
      });
    &lt;/script&gt;
  }
  </code></pre>