Displayname does not work in relationship

Asked

Viewed 54 times

1

have a model:

public class TalaoCode : ITalaoCode
    {
        [Key]
        public int TalaoCodeId { get; set; }

        [DisplayName("Equipe")]
        public int EquipeId { get; set; }

        [DisplayName("Equipe")]
        public virtual Equipe Equipe { get; set; }
}

See that I put the attribute DisplayName in both, but when it is called in the view created by Scanfolding default, it does not exist the text of DisplayName and yes EquipeId

View created by Scanfolding

@Html.LabelFor(model => model.EquipeId, "EquipeId", new { @class = "control-label col-md-2" })

I’ve tried to use [Display(Name ="Equipe")] but also without success. Always appears Equipeid

inserir a descrição da imagem aqui

1 answer

2


What happens is that you are specifying the parameter labelText, then what’s in the DisplayName will not be shown.

Alter your LabelFor for

@Html.LabelFor(model => model.EquipeId, htmlAttributes: new { @class = "control-label" })
  • True, had not noticed, scanfolding louse.. rs

Browser other questions tagged

You are not signed in. Login or sign up in order to post.