When adding a css class attribute using new { @class="form-control"} to a textbox generated using html helpers, the attribute is added as a value while the same approach works fine with the textarea control.
@{
ViewBag.Title = "New";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<h2>New</h2>
<div>
<div class="col-md-4">
@using (Html.BeginForm())
{
<div class="form-group">
@Html.Label("Title");
@Html.TextBox("Title", new { @class = "form-control" })
</div>
<div class="form-group">
@Html.Label("Body")
@Html.TextArea("Body", new{ @class="form-control"} )
</div>
}
<div class="form-group">
<input class="btn btn-default" name="edit" value="edit"/>
<input class="btn btn-default" name="save" value="Save" />
</div>
</div>
</div>