I’m having this strange issue with MVC 3 in that I cannot use a variable to assign multiple classes to an html string. It seems to break every time I use a space in the string. For instance, if I use this variable:
var MultipleClasses = "ClassOne ClassTwo";
and then assign that to an html element as a class:
<tr class = @MultipleClasses>blah blah</tr>
The second class always displays outside of the quotes:
<tr class = "ClassOne" ClassTwo>blah blah</tr>
Any ideas? Or, any suggestions for a work around? Much appreciated!
Try this:
It’s because you have no quotes around the attribute value, then you’re doing a space, so it thinks you’re trying to start the next attribute on the html element