I am creating a static using Html.LabelFor(…).
I have to set Name attribute of the label dynamically using JQuery.
I am creating a static using Html.LabelFor(…). I have to set Name attribute of
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can set the css class, and set inline styles and any other attribute (even non-existant ones like name) using the htmlAttributes parameter provided in one of the overloads of LabelFor
ie
this would create a label something like:
The reason for the @ before class, is that “class” is a reserved word in c#, so you need to qualify it using the @ symbol.