title: Incorrect Razor syntax
body: <p>I'm having some trouble understanding how <code>@Razor</code> works in a view. The code below is my view where a user can create a new post (I'm creating a forum)</p>
  
  <p>What I want to do is remove the <code>&lt;Fieldset&gt;</code>
  My problem is that I can't change the code I've marked.</p>
  
  <pre><code>@model Forum3.Models.Posts
  
  &lt;h2&gt;CreatePost&lt;/h2&gt;
  
  @using (Html.BeginForm()) {
      @Html.ValidationSummary(true)
  //--- CAN'T EDITED ----
      &lt;fieldset&gt;
          &lt;legend&gt;Post&lt;/legend&gt;
          @*SET TopicID*@
          @{
  Html.HiddenFor(model =&gt; model.TopicId);
  @Html.Hidden("TopicId",ViewData["currentTopicId"]);
             }
  //----END----
  
          &lt;div class="editor-label"&gt;
              @Html.LabelFor(model =&gt; model.Text)
          &lt;/div&gt;
          &lt;div class="editor-field"&gt;
              @Html.EditorFor(model =&gt; model.Text)
              @Html.ValidationMessageFor(model =&gt; model.Text)
          &lt;/div&gt;
  
          &lt;p&gt;
              &lt;input type="submit" value="Create" /&gt;
          &lt;/p&gt;
      &lt;/fieldset&gt;
  }
  
  &lt;div&gt;
      @Html.ActionLink("Back to List", "Index")
  &lt;/div&gt;
  
  @section Scripts {
      @Scripts.Render("~/bundles/jqueryval")
  }
  </code></pre>
  
  <p>If I remove the <code>&lt;Fieldset</code>> and <code>&lt;Legend</code>> I get this error on my <code>HiddenFor</code> code:
  <code>Parser Error Message: Unexpected "{" after "@" character. Once inside the body of a code block (@if {}, @{}, etc.) you do not need to use "@{" to switch to code.</code></p>
  
  <p>If I then remove the <code>@{...}</code> to look like this:</p>
  
  <pre><code>@Html.HiddenFor(model =&gt; model.TopicId);
  @Html.Hidden("TopicId",ViewData["currentTopicId"]);
  </code></pre>
  
  <p>I'll get an error when I click <code>Create</code> because the TopicId is not being set to my <code>currentTopicId</code> (This also happens if I leave the <code>&lt;fieldset&gt;</code> in)</p>
  
  <p>I have no idea what going on here. Any ideas?</p>