I made a form in one of the View
of my project, and now I want to apply Bootstrap to give it style, is it possible to do it?
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 class form-horizontal
of Bootstrap. My code is as follows:
@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 in this way new {@class = "form-horizontal form-control"}
does not work, and also not in this way <form class = "form-horizontal"></form>