LabelFor + EditorFor on the same line?

.net, asp.net, asp.net-mvc, asp.net-mvc-3, razor

Solution

Just remove the divs separating them, this works for me, I get `Ticket []` with this.

Also, use `CheckBoxFor` if you know it is a `CheckBox`

<div>
    @Html.LabelFor(model => model.Ticket)
    @Html.CheckBoxFor(model => model.Ticket)
    @Html.ValidationMessageFor(model => model.Ticket)
</div>

I have also used this code as the OP stated this is his code

<div class="editor-field">
    @Html.Label("SMS Alerts?")
    @Html.EditorFor(model => model.GetAll)
</div>

I get `GetAll []`

`GetAll` is a `bool` in my ViewModel

Also used this

<div>
    @Html.LabelFor(model => model.GetAll)
    @Html.EditorFor(model => model.GetAll)
</div>

I get `GetAll []`

And this

<div class="editor-field">
    @Html.LabelFor(model => model.GetAll)
    @Html.EditorFor(model => model.GetAll)
</div>

I get `GetAll []`

In every case my tests are label and checkbox are inline

Problem

I have this code: ``` <div class="editor-label"> @Html.LabelFor(model => model.Ticket) </div> <div class="editor-field"> @Html.EditorFor(model => model.Ticket) @Html.ValidationMessageFor(model => model.Ticket) </div> ``` How do I get the label and checkbox(in this case its a checkbox) on the same line? I have tried removing the divs and they still come out on different lines. Thank you.

Original source