I made a form in one View
of my project, and now I want to apply Bootstrap to it to style it, is it possible to do that?
I tried it this way but without results:
<form class="form-horizontal">
<label>Nombre</label>
@Html.TextBoxFor(x => x.NombreUsuario)
<br />
<label>Direccion</label><br />
@Html.TextBoxFor(x => x.Direccion)
<br />
<label>Telefono</label><br />
@Html.TextBoxFor(x => x.Telefono)
<br />
<label>Email</label><br />
@Html.TextBoxFor(x => x.Email)
<br />
</form>
UPDATE
I was able to do it, and now I would like to use the form-horizontal
Bootstrap class. My code is the following:
@using (Html.BeginForm("Guardar", "Usuario", FormMethod.Post))
{
@Html.HiddenFor(x => x.IdUsuario)
<label>Nombre</label><br />
@Html.TextBoxFor(x => x.NombreUsuario, new { @class = "form-control" })
<br />
<label>Contrasena</label><br />
@Html.TextBoxFor(x => x.Contrasena, new { @class = "form-control" })
<br />
<label>Direccion</label><br />
@Html.TextBoxFor(x => x.Direccion, new { @class = "form-control" })
<br />
<label>Telefono</label><br />
@Html.TextBoxFor(x => x.Telefono, new { @class = "form-control" })
<br />
<label>Email</label><br />
@Html.TextBoxFor(x => x.Email, new { @class = "form-control" })
<br />
}
Adding it like this new {@class = "form-horizontal form-control"}
doesn't work, and neither like this<form class = "form-horizontal"></form>
yes it is possible, if you mean adding styles try this:
edited
Adding styles to your form: