I use editor templates in ASP.net MVC. Should I put the form inside the editor template or outside the template?
Example:
Inside
~ / Views / Products / Create.cshtml
@Html.EditorForModel()
~ / Views / Products / EditorTemplates / CreateProduct.cshtml
@using(Html.BeginForm()) { @Html.EditorFor(model => model.Name) <input type="submit" value="Save" /> }
Beyond
~ / Views / Products / Create.cshtml
@using(Html.BeginForm()) { @Html.EditorForModel() <input type="submit" value="Save" /> }
~ / Views / Products / EditorTemplates / CreateProduct.cshtml
@Html.EditorFor(model => model.Name)
source share