Bootstrap MVC 4 TextBoxFor必需指标

时间:2014-01-08 03:00:16

标签: css asp.net-mvc asp.net-mvc-4 twitter-bootstrap

我完全糊涂了。我在页面上有6个输入用于注册页面。其中三个盒子在盒子的右侧有所需的指示器,其他三个没有。代码中需要所有6个字段。 enter image description here

我查看了代码,MVC正在添加背景图像或Bootstrap。 这是我正在使用的Razor代码。

 <div class="row ">
            <div class="col-md-6">
                <div class="row">
                    @Html.TextBoxFor(m => m.currentUser.UserName, new { @class = "form-control", placeholder = "user name", tabindex = 1 })

                </div>

                <div class="row">
                    @Html.PasswordFor(m => m.currentUser.Password, new { @class = "form-control", placeholder = "password", tabindex = 3 })

                </div>
                <div class="row">
                    @Html.TextBoxFor(m => m.currentUser.LastName, new { @class = "form-control", placeholder = "last name", tabindex = 6 })

                </div>
            </div>
            <div class="col-md-6">
                <div class="row">
                    @Html.TextBoxFor(m => m.currentUser.EmailAddress, new { @class = "form-control", placeholder = "email address", tabindex = 2 })
                </div>
                <div class="row">
                    @Html.PasswordFor(m => m.confrimPassword, new { @class = "form-control", placeholder = "confirm password", tabindex = 4 })

                </div>
                <div class="row">
                    @Html.TextBoxFor(m => m.currentUser.FirstName, new { @class = "form-control", placeholder = "first name", tabindex = 5 })

                </div>
            </div>
        </div>

我对Bootstrap没有多少经验,所以我不确定这是导致问题的原因还是MVC。

感谢任何帮助。

这是模型类:

 public class User
{
    public int ID { get; set; }

    [Required(ErrorMessage = "Please enter a User Name.")]
    public string UserName { get; set; }

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

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

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

    [Required(ErrorMessage = "Please enter an email address.")]
    public string EmailAddress { get; set; }
}

这是生成的具有指示符的输入代码:

<input class="form-control" data-val="true" data-val-required="Please enter a password" id="currentUser_Password" name="currentUser.Password" placeholder="password" tabindex="3" type="password" autocomplete="off" keyev="true" clickev="true" style="background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAASCAYAAABSO15qAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3QsPDhss3LcOZQAAAU5JREFUOMvdkzFLA0EQhd/bO7iIYmklaCUopLAQA6KNaawt9BeIgnUwLHPJRchfEBR7CyGWgiDY2SlIQBT/gDaCoGDudiy8SLwkBiwz1c7y+GZ25i0wnFEqlSZFZKGdi8iiiOR7aU32QkR2c7ncPcljAARAkgckb8IwrGf1fg/oJ8lRAHkR2VDVmOQ8AKjqY1bMHgCGYXhFchnAg6omJGcBXEZRtNoXYK2dMsaMt1qtD9/3p40x5yS9tHICYF1Vn0mOxXH8Uq/Xb389wff9PQDbQRB0t/QNOiPZ1h4B2MoO0fxnYz8dOOcOVbWhqq8kJzzPa3RAXZIkawCenHMjJN/+GiIqlcoFgKKq3pEMAMwAuCa5VK1W3SAfbAIopum+cy5KzwXn3M5AI6XVYlVt1mq1U8/zTlS1CeC9j2+6o1wuz1lrVzpWXLDWTg3pz/0CQnd2Jos49xUAAAAASUVORK5CYII=); padding-right: 0px; background-attachment: scroll; cursor: auto; background-position: 100% 50%; background-repeat: no-repeat no-repeat;">

真正奇怪的部分是我发现它们出现在Chrome中而不是Firefox中。

1 个答案:

答案 0 :(得分:6)

@nemesv - 你是完全正确的。 LastPass是我在Chrome中安装的扩展程序之一。一旦我禁用它,图标就被删除了。把头发拉了几天试图找出那个。