is it possible to add bootstrap class attributes to EditorForModel?
The model generates 4 fields but they are not properly aligned. I was trying to add form-control
class but it add the attribute in each field.
This is how I added the Form:
@using (Html.BeginForm())
{
<fieldset>
@Html.AntiForgeryToken()
<legend>@ViewBag.Title</legend>
@Html.EditorForModel(new { htmlAttributes = new { @class = "form-control" }})
<p><input type="submit" value="Save" /></p>
</fieldset>
}
add this is whats in the page-source
<form action="/Products/Edit/1" method="post">
<fieldset>
<input name="__RequestVerificationToken" type="hidden" value="eIwHZW5P2wPCTWgcqYe9SH2Ad_rKuYNWgvvplsqxo7vYLGXzaXlVKR5pPrjVsag7lRmUsm1M-r3sZYDQyThLL_1o1PQUKnKgbCuI88NwQMQ1" />
<legend>Edit</legend>
<input class="form-control" data-val="true" data-val-number="The field ProductID must be a number." data-val-required="The ProductID field is required." id="ProductID" name="ProductID" type="hidden" value="1" /><div class="editor-label"><label for="ProductName">Product Name</label></div>
<div class="editor-field"><input class="form-control text-box single-line" data-val="true" data-val-required="Product name is required." id="ProductName" name="ProductName" type="text" value="chai" /> <span class="field-validation-valid" data-valmsg-for="ProductName" data-valmsg-replace="true"></span></div>
<div class="editor-label"><label for="SupplierID">SupplierID</label></div>
<div class="editor-field">