mvc, asp.net, razor

@Html.LabelFor(m => m.email, new { @class="control-label" })
   
Just try to make above codes working in MVC 3 razor but now alert an error.
solution1368Asked:
Who is Participating?
 
StephanLead Software EngineerCommented:
0
 
käµfm³d 👽Commented:
What is the error?
0
 
solution1368Author Commented:
Compiler Error Message: CS1928: 'System.Web.Mvc.HtmlHelper<SuretyNetwork.Controllers.SignUpModel>' does not contain a definition for 'LabelFor' and the best extension method overload 'System.Web.Mvc.Html.LabelExtensions.LabelFor<TModel,TValue>(System.Web.Mvc.HtmlHelper<TModel>, System.Linq.Expressions.Expression<System.Func<TModel,TValue>>, string)' has some invalid arguments
0
 
käµfm³d 👽Commented:
From what I can see, in MVC 3 you only have two overloads of the LabelFor method:

Screenshot
...neither of which accepts a parameter to set the HTML attributes of the resulting label. The only thing I can find for MVC 3 is solutions involving creating your own extension method (which you could certainly do).
0
 
solution1368Author Commented:
i don't know how to do it. can you please show me?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.