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.
My reusable code is
<div class="dialog" id="@Model.HtmlId">
<!-- My reusable code needs to go here -->
</div>
Creating a partial view is easy, but the problem is that partial views accept a Model as a parameter.
My current solution is ugly.
@Html.Partial("_startDialog", new { HtmlId="someIdGoesHere" });
<form>
<!-- Some form elements go here -->
</form>
@Html.Partial("_endDialog");
This renders
<div class="dialog" id="@Model.HtmlId">
<form>
<!-- Some form elements go here -->
</form>
</div>
How can I stream line this. Elegance would be nice :-)