This is my first time trying MVC.
This code
<%= Html.LabelFor(model => model.Name) %>
produces this
<label for="Name">Name</label>
But I want this
<label for="Name" class="myLabel">Name</label>
How do you do that?
Thanks in advance.
This is my first time trying MVC.
This code
<%= Html.LabelFor(model => model.Name) %>
produces this
<label for="Name">Name</label>
But I want this
<label for="Name" class="myLabel">Name</label>
How do you do that?
Thanks in advance.
Okay, looking at the source (System.Web.Mvc.Html.LabelExtensions.cs) for this method, there doesn't seem to be a way to do this with an HtmlHelper in ASP.NET MVC 2. I think your best bet is to either create your own HtmlHelper or do the following for this specific label:
<label for="Name" class="myLabel"><%= Model.Name %>"</label>