I\'m trying to add a css class to a textbox. This is what I have in my view:
<%: Html.EditorFor(m => m.StartDate) %>
I tried follo
With MVC3, I kept banging my head because I couldn't get this to work. I didn't want to create a whole EditorTemplate for just adding one class.
Well, instead of using EditorFor, use TextBoxFor, with of course the equals sign like so:
@Html.TextBoxFor(m=> m.ZipCode, new { @class = "zip" })
Here's a very simple solution: Remove the double quotes from "datepicker"
and retype them back into Visual Studio and it should work.
I had the same problem. I copied/pasted sample code from the web and the code had a special type of quote which caused the ","
syntax problem. I know it's really not obvious.