如何关闭@ Html.TextBoxFor的突出显示框

时间:2014-03-21 01:40:48

标签: html asp.net-mvc html5 visual-studio asp.net-mvc-5

所以我有一个用户模型,我试图让用户注册。这一切都很好但是当我选择一个框以在蓝色中突出显示框突出显示。我不希望这种情况发生。此外,如果验证失败,框会变成红色,我也不想发生这种情况。这是我可以关闭的东西吗?或许我使用了错误的东西。我不知道,我对此非常陌生,我只是希望它看起来很完美。

所以我有类似的东西:

 public class User
{
    [Key]
    public int Id { get; set; }

    [Required(ErrorMessage = "Please enter your first name.")]
    [Display(Name = "First Name:")]
    public string FirstName { get; set; }

    [Required(ErrorMessage = "Please enter your last name.")]
    [Display(Name = "Last Name:")]
    public string LastName { get; set; }

    [Required(ErrorMessage = "Please enter your email address.")]
    [Display(Name = "Email Address:")]
    [DataType(DataType.EmailAddress)]
    public string Email { get; set; }

    [Required(ErrorMessage = "Please enter a password.")]
    [Display(Name = "Password")]
    [DataType(DataType.Password)]
    public string Password { get; set; }
}

然后在我看来,我有:

 @using (Html.BeginForm())
    {
        @Html.TextBoxFor(m => m.FirstName, new { @placeholder = "First Name", @class = "TextBoxClass", autocomplete = "off" })
        @Html.TextBoxFor(m => m.LastName, new { @placeholder = "Last Name", @class = "TextBoxClass", autocomplete = "off" })
        @Html.TextBoxFor(m => m.Email, new { @placeholder = "Email Address", @class = "TextBoxClass", autocomplete = "off" })
        @Html.TextBoxFor(m => m.Password, new { @placeholder = "Password", @class = "TextBoxClass", autocomplete = "off", type = "password" })
        <br />
        <div>
            <span>@Html.ValidationMessageFor(m => m.FirstName)</span>
            <span>@Html.ValidationMessageFor(m => m.LastName)</span>
            <span>@Html.ValidationMessageFor(m => m.Email)</span>
            <span> @Html.ValidationMessageFor(m => m.Password)</span>
        </div>
        <input id="RegisterButton" type="submit" value="Sign Up" />
    }

编辑:在下面的textboxclass中显示css:

.TextBoxClass {
        width: 250px;
        height: 40px;
        font-size: 16px;
        font-family: Helvetica Neue, HelveticaNeue, Helvetica, Arial, sans-serif;
        text-decoration-color: none;
    }

0 个答案:

没有答案