I render my ViewModel with
Create.cshtml:
@using (Html.BeginForm("Create","TestTemplate")) {
@Html.EditorForModel()
}
I do not like the output content because all the divs are one below the other. What if I want a horizontal layout where one div floats lefthandside to the other div?
How can I modify such layout changes using the EditorForModel() helper when there is no html in my Create.cshtml view ?
UPDATE:
Why do I have to create TWO views. In the one I call @Html.EditorForModel() in the other EditorTemplate-view I do all the layout stuff which I could also do within the first view via EditorFor( x => x….) ??? This seems strange to me.
You want to create an EditorTemplate. Basically create a new folder called
EditorTemplatesin~/Views/Sharedand then create a new view within that folder that has the name of your model, e.g.Template.cshtmlor whatever.When you call
@Html.EditorForModel()it will use this view as the template.