I am setting the values for DataAnnotations DisplayAttributes Order property in my model object. However, it seems to be not working.
I am on .Net Framework 4.7 and MVC 5. As per the below link, its supposed to work.
[Required(ErrorMessage = "Case is required.")]
[Display(Name = "Case", Order = -98)]
public int CaseId { get; set; }
[Required(ErrorMessage = "Phase is required.")]
[Display(Name = "Phase", Order = -99)]
public int PhaseId { get; set; }
Since the default order weight is 0, I used negative values to set it in the order I want. Irrespective of what Order weight I specify, the validation messages are always displayed in the order of the property declaration in the model.
Any suggestions or inputs please?
Thanks in advance.