I currently have a div container for all of the input fields in my form, similar to:
<div class="ux-single-field ui-widget-content ui-corner-all">
@Html.LabelFor(m => m.Name)
@Html.TextBoxFor(m => m.Name)
</div>
I would like to know how could I encapsulate this using a templated razor delegate (or any other trick), so just like we use:
@using (Html.BeginForm()) {
}
I could simply wrap my elements like:
@using (Html.ContentField()) {
@Html.LabelFor(m => m.Name)
@Html.TextBoxFor(m => m.Name)
}
Using the Razor View Engine, here is what works:
FYI: Using the old ASPX engine, here’s how to do it.