-2

Screenshots:

I want disable email field but [Editable(false)] attribute does not work.

How can I solve this problem?

[NopResourceDisplayName("Admin.Address.Fields.Email")]
[AllowHtml]
//[Editable(false)]
public string Email { get; set; }

ReadOnly(true) attribute also does not work.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • 3
    Do not post image of your code... paste as text, so that it is easily viewed & searched. – Anand Sowmithiran Jan 08 '23 at 12:43
  • See the answer https://stackoverflow.com/a/29248004/14973743 – Anand Sowmithiran Jan 08 '23 at 12:45
  • It looks like there are red underlines in your code,`@Html.EditFor()`,you need to check if you have missed something.And when using `@Html.EditFor()`,`readonly` will not work,you need to use `@Html.TextBoxFor` as `harrysrangal` said. – Yiyi You Jan 09 '23 at 08:06

1 Answers1

0

You can change your HTML Helper method from EditorFor to TetBoxFor. Something line this.

@Html.TextBoxFor(model => model.Email, new { @class = "form-control", @readonly = "readonly" })
HarrY
  • 607
  • 4
  • 14