Вот код для представления, о котором я говорю:
@model OnlineGaming.WebUI.Models.RegisterModel
@{
ViewBag.Title = "Bienvenidos!";
}
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<div id="gamesdisplay">
Aqui voy a mostrar lo juegos.
</div>
<div id="registerform">
@Html.ValidationSummary(true, "No se pudo crear la cuenta.")
@using (Html.BeginForm()) {
<div>
<div class="editor-label">
@Html.LabelFor(m => m.UserName):
@Html.TextBoxFor(m => m.UserName)
@Html.ValidationMessageFor(m => m.UserName)
</div>
<div class="editor-label">
@Html.LabelFor(m => m.Password):
@Html.PasswordFor(m => m.Password)
@Html.ValidationMessageFor(m => m.Password)
</div>
<div class="editor-label">
@Html.LabelFor(m => m.ConfirmPassword):
@Html.PasswordFor(m => m.ConfirmPassword)
@Html.ValidationMessageFor(m => m.ConfirmPassword)
</div>
<div class="editor-label">
@Html.LabelFor(m => m.DateOfBirth):
@Html.TextBoxFor(m => m.DateOfBirth)
@Html.ValidationMessageFor(m => m.DateOfBirth)
</div>
<p>
<input type="submit" value="Iniciar Sesion" />
</p>
</div>
}
</div>
Каждый элемент, сгенерированный помощниками HTML, выводит:
<div class="editor-label">
<label for="UserName">Nombre de Usuario</label>:
<input data-val="true" data-val-required="The Nombre de Usuario field is required." id="UserName" name="UserName" type="text" value="" />
<span class="field-validation-valid" data-valmsg-for="UserName" data-valmsg-replace="true"></span>
</div>
<div class="editor-label">
<label for="Password">Contraseña</label>:
<input data-val="true" data-val-length="The Contrase&#241;a must be at least 6 characters long." data-val-length-max="100" data-val-length-min="6" data-val-required="The Contrase&#241;a field is required." id="Password" name="Password" type="password" />
<span class="field-validation-valid" data-valmsg-for="Password" data-valmsg-replace="true"></span>
</div>
Вот как это выглядит:
Как можно выровнять эти поля ввода, чтобы форма выглядела аккуратнее?