Using Html.LabelFor to display human readable label?

Posted by Shay Friedman on Stack Overflow See other posts from Stack Overflow or by Shay Friedman
Published on 2010-04-28T14:50:01Z Indexed on 2010/04/28 14:53 UTC
Read the original article Hit count: 215

Filed under:

I'm using ASP.NET MVC 2 and I'm struggling to understand how can I use the Html.LabelFor helpet method.

Assuming I have a model:

public class Person
{
  public string FirstName { get; set; }
}

In my view, if I write:

<%: Html.LabelFor(model => model.FirstName) %>

What I get on the page is "FirstName". But I don't want that because it's now user-friendly. I want it to be "First Name".

How do I achieve that?

Thanks.

© Stack Overflow or respective owner

Related posts about asp.net-mvc-2