Wednesday, August 15, 2012

disable a passwordbox inside dataform

disable a passwordbox inside dataform

Hi All,

I am using dataform to edit user information. I have various user properties that are bound to the dataform. I do not want to let the user edit the password from the dataform. I have a separate logic for old password, new password, confirm password elsewhere. So what I am trying to make the passwordbox in the dataform appear as disabled. But this is not working. This generally works for textbox and other control. is there something different that I need to do for passwordBox?

Code:

 public class My_User : IEditableObject      {        [Display(AutoGenerateField=false)]      [Bindable(false)]          public int UserId { get; set; }        [Display(Name = "First Name")]      [StringLength(30, MinimumLength=3,      ErrorMessage="First name should have between 3 and 30 characters")]      [Required(ErrorMessage="First name is required")]                    public string FirstName { get; set; }        [Display(Name = "Middle Name")]            public string MiddleName { get; set; }        [Display(Name = "Last Name")]      [StringLength(30, MinimumLength = 3,      ErrorMessage = "Last name should have between 3 and 30 characters")]      [Required(ErrorMessage = "Last name is required")]            public string LastName { get; set; }        [Display(Name = "Display Name")]        [StringLength(20, MinimumLength = 3,      ErrorMessage = "User name should have between 3 and 20 characters")]      [Required(ErrorMessage = "Display name is required")]            public string DisplayName { get; set; }        [StringLength(30, MinimumLength = 3,      ErrorMessage = "Password should have between 3 and 30 characters")]      [Required(ErrorMessage = "Password is required")]            public string Password { get; set; }        [Display(Name = "Phone Number")]            public string PhoneNo { get; set; }        [Display(Name = "Mobile Number")]            public string MobileNo { get; set; }            public string Address { get; set; }        [Display(Name = "Comment")]            public string Description { get; set; }        [Required]            public bool IsActive { get; set; }        [StringLength(30, MinimumLength = 3,      ErrorMessage = "Email should have between 3 and 30 characters")]      [Required(ErrorMessage = "Email is required")]      [Display(Name = "email address")]            public string Email { get; set; }            public Roles RoleName { get; set; }              #region IEditableObject Members            public void BeginEdit()          {                       }            public void CancelEdit()          {                       }            public void EndEdit()          {                       }            

No comments:

Post a Comment

Send us your comment related to the topic mentioned on the blog