Kendo UI MVC 的密码文本框

Password TextBox for Kendo UI MVC

我想使用 Telerik Kendo UI 文本框创建登录页面,因此我需要屏蔽我的密码输入。有没有人有什么建议?我试过:

                .TextBoxFor(m => m.Password)
                .HtmlAttributes(new { type = "password" })

下面是我的代码,它几乎是标准的:

  @(Html.Kendo().TextBox()
                .Name("password")
                .Placeholder("Password")
                .Label(label => label
                    .Content("Password")
                    .Floating(true)
                )
                .HtmlAttributes(new { style = "width: 100%;border-radius: 7px;border-color: #ff4d41;" })
            )

进入舞台我会更快创建我自己的文本框哈哈

根据你的问题我的理解 你需要在 kendo UI 控件中添加 type="password".

喜欢下面的代码

 @(Html.Kendo().TextBox()
.Name("password")
.Placeholder("Password")
.Label(label => label
.Content("Password")
.Floating(true)
)
.HtmlAttributes(new {type="password", style = "width: 100%;border-radius: 7px;border-color: #ff4d41;" })
)      

Output

众所周知 Password HTML MVC 中可用的助手。

@Html.Password()
@Html.PasswordFor()