title: How to cleanly reuse edit / new views in Asp.NET MVC
body: <p>I'm trying to avoid code like this when reusing the same ViewUserControl in ASP.NET MVC. Any suggestions?</p>
  
  <pre><code>&lt;% if (ViewContext.ViewData["editMode"].ToString() == "edit"){ %&gt;
      &lt;%= Html.SubmitButton("submit", "Update Brand")%&gt;&lt;span class="or"&gt;Or&lt;/span&gt;&lt;a href="#" class="cancel"&gt;Cancel&lt;/a&gt;
  &lt;% } else { %&gt;
      &lt;%= Html.SubmitButton("submit", "Create New Brand")%&gt;&lt;span class="or"&gt;Or&lt;/span&gt;&lt;a href="#" class="cancel"&gt;Cancel&lt;/a&gt;
  &lt;%} %&gt;
  </code></pre>
  
  <p>And ...</p>
  
  <pre><code>&lt;% if (ViewContext.ViewData["editMode"].ToString() == "edit"){ %&gt;
      &lt;h1 class="edit"&gt;Edit Brand Details&lt;/h1&gt;
  &lt;% } else { %&gt;
      &lt;h1 class="create"&gt;Create A New Brand&lt;/h1&gt;
  &lt;%} %&gt;
  </code></pre>