40

I have tried:

@Html.TextBoxFor(m => m.UserName, new {@class='textbox'})

which isn't working.

1 Answer 1

67
@Html.TextBoxFor(m => m.UserName, new {@class="textbox"})

A c# string literal does not take single quotes.

'textbox' -> "textbox"

Sign up to request clarification or add additional context in comments.

2 Comments

You'r so right.. I blame it on the later hour... Shouldn't be coding in the middle of the night. Even the exception messages was telling me this (mayby in a more cryptic way)
For multiple classes e.g... @Html.TextBoxFor(m => m.UserName, new {@class="textbox, anotherClass"})

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.