title: How to create a reusable piece of HTML with dynamic contents
body: <p>I'm trying to create a reusable fragment of HTML that I'd like to be able to accept additional HTML as some sort of parameter.</p>
  
  <p>My reusable code is</p>
  
  <pre><code>&lt;div class="dialog" id="@Model.HtmlId"&gt;
  
    &lt;!-- My reusable code needs to go here --&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Creating a partial view is easy, but the problem is that partial views accept a Model as a parameter.</p>
  
  <p>My current solution is ugly.</p>
  
  <pre><code>@Html.Partial("_startDialog", new { HtmlId="someIdGoesHere" });
  
  &lt;form&gt;
    &lt;!-- Some form elements go here --&gt;
  &lt;/form&gt;
  
  @Html.Partial("_endDialog");
  </code></pre>
  
  <p>This renders</p>
  
  <pre><code>&lt;div class="dialog" id="@Model.HtmlId"&gt;
  
    &lt;form&gt;
      &lt;!-- Some form elements go here --&gt;
    &lt;/form&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>How can I stream line this. Elegance would be nice :-)</p>