Search code examples
sqlasp.net-mvc-5html-helper

Change default @html.DisplayNameFor


guys. I've been thinking. I'm making a table based on a database column. So, by default, asp.net gave (for example) :

@html.DisplayNameFor(model => model.FULL_NAME);

But then it would displayed it just like that. Are there anyways to change the display in the view to "Full Name" or "Name", maybe?

Thanks a lot!


Solution

  • You can use [Display] in the model

    public class User
    {
       [Display(Name = "Name")]
       public string FULL_NAME;
    }