How does one add an "id" attribute to Html.LabelFor() in ASP.NET MVC2?

Posted by MartinK on Stack Overflow See other posts from Stack Overflow or by MartinK
Published on 2010-04-13T16:00:04Z Indexed on 2010/04/13 16:03 UTC
Read the original article Hit count: 244

How would one add an "id" attribute to Html.LabelFor() in ASP.NET MVC2?

This is my label code:

<%=Html.LabelFor(x => x.FirstName)%>

This is my failed attempt:

<%=Html.LabelFor(x => x.FirstName, new { @id = "first-name" } )%>

Thanks.

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about asp.net-mvc-2