@using (Html.BeginForm("Unassign", "Terminals_DataGroups"))
{
@Html.HiddenFor(m => m.DeviceId)
@Html.HiddenFor(m => m.DataGroupId)
<input type="submit" value="Remove group from device" @(string.IsNullOrEmpty(Model.DataGroupName) ? "disabled=\"disabled\"" : "") />
}
@using (Html.BeginForm("Assign", "Terminals_DataGroups"))
{
@Html.HiddenFor(m => m.DeviceId)
<div class="editor-label">
@Html.LabelFor(model => model.DataGroups)
</div>
<div class="editor-field">
@Html.DropDownListFor(model => model.DataGroupsSelectedItem, new SelectList(Model.DataGroups, "Value", "Text"))
@Html.ValidationMessageFor(model => model.DataGroupsSelectedItem)
</div>
<input type="submit" value="Assign Data Group" />
}
Yet the HTML renders as:
<form action="/Terminals_DataGroups/Assign" method="post">
<input data-val="true"
data-val-number="The field DeviceId must be a number."
data-val-required="The DeviceId field is required."
id="DeviceId"
name="DeviceId"
type="hidden"
value="15" />
<input data-val="true"
data-val-number="The field DataGroupId must be a number."
id="DataGroupId"
name="DataGroupId"
type="hidden"
value="1" />
<input type="submit" value="Remove group from device" />
</form>
<form action="/Terminals_DataGroups/Assign" method="post">
<input data-val="true"
data-val-number="The field DeviceId must be a number."
data-val-required="The DeviceId field is required."
id="DeviceId"
name="DeviceId"
type="hidden"
value="15" />
<div class="editor-label">
<label for="DataGroups">Data groups</label>
</div>
<div class="editor-field">
<select data-val="true"
data-val-number="The field DataGroupsSelectedItem must be a number."
id="DataGroupsSelectedItem"
name="DataGroupsSelectedItem">
<option value="2">DataGroup2</option>
<option value="3">DataGroup3</option>
<option value="5">New group</option>
</select>
<span class="field-validation-valid"
data-valmsg-for="DataGroupsSelectedItem"
data-valmsg-replace="true"></span>
</div>
<input type="submit" value="Assign Data Group" />
</form>