Unplanned
Last Updated: 03 Apr 2025 11:20 by ADMIN
Philip
Created on: 17 Dec 2024 21:50
Category: UI for ASP.NET MVC
Type: Feature Request
0
Add a Password field

In many applications we use passwords. Would love to have a field that allows for the setting of a type to "password" without templates. 

.PasswordTextField() or something similar. 

**Added by Admin**
If I pass in the model, the fields should get affected by the `DataType(Datatype.Password)` data annotation attribute.

5 comments
ADMIN
Eyup
Posted on: 03 Apr 2025 11:20

Hi Philip,

 

Thank you for the clarification. I have directly added this note to the original post and changed the status:
https://feedback.telerik.com/aspnet-mvc/1673787-add-a-password-field

 

Regards,
Eyup
Progress Telerik

Enjoyed our products? Share your experience on G2 and receive a $25 Amazon gift card for a limited time!

Philip
Posted on: 27 Mar 2025 13:47
FYI, this only works when you explicitly list the items in `.Items(items => {})` - should I create a bug report to mention this? If I pass in the model, the fields show up as expected, but they don't get affected by the `DataType(Datatype.Password)`
ADMIN
Eyup
Posted on: 25 Dec 2024 15:48

Hi Philip,

 

Yeah, the .cs model annotation attribute is the most straightforward approach and I am glad it will work for you.

Nevertheless, I will keep the feedback item open for now so others customers can check it and vote for it.

Thank you for sharing this cool idea!

 

Regards,
Eyup
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Philip
Posted on: 18 Dec 2024 16:49

Hi Eyup,

Thanks for the response. I don't know if I would ever use the password outside the context of a form, so your syntax here wouldn't help me:

 @(Html.Kendo().TextBox()
          .Name("textbox")
          .HtmlAttributes(new {type="password"})
          .Value("test")
 )

If I do that same syntax above within a form, it doesn't work.

items.Add()
.Field(f => f.Password)
.Label(l => l.Text("Password:"))
.Editor(field => field.TextBox().HtmlAttributes(new { type = "password " }))



That being said, I had read that validation page and hadn't thought to check the .cs model file to see if that respected the result. 

Thank you!

ADMIN
Eyup
Posted on: 18 Dec 2024 13:03

Hello Philip,

 

Thank you for writing to us.

Yes, the Password type is a common requirement for a lot of applications. The .NET framework provides its built-in Data Annotation Attribute to help with this:

        [Required]
        [Display(Name = "Choose Password:")]
        [DataType(DataType.Password)]
        public string Password
        {
            get;
            set;
        }
And our components are designed with these Model attributes in mind:
https://demos.telerik.com/aspnet-core/form/validation

And also, it is possible to define the textbox component as a password field directly from the server:

        @(Html.Kendo().TextBox()
            .Name("textbox")
            .HtmlAttributes(new {type="password"})
            .Value("test")
        )
I have prepared a live sample for demonstration:
https://netcorerepl.telerik.com/GebQFMld02hE09FM02

Do you find these options beneficial for your projects?

 

Regards,
Eyup
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.