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;" })
            )

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

解决方法

根据我对你的问题的理解 您需要在剑道 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;" })
)      

输出 Image

我们知道 Password HTML helper 在 MVC 中可用。

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