MVC Razor context commutation problem
I'm trying to output a "x3" string with value stored in my model.
<span>x@Model.Quantity</span>
output => x@Model.Quantity
doesn't switch correctly to code after @.
The following works correctly:
<span>*@Model.Quantity</span>
=> *3
<span>x @Model.Quantity</span>
=> x 3 (but I don't want the space of course)
My actual fix:
<span>@{<text>开发者_JS百科x</text>}@Model.Quantity</span>
=> x3
Does the @ commutator needs to follow a word boundary? Is it a bug of the parser? (my actual testing machine: MVC3 RC2)
Thx
x@Model.Quantity could be a email address so I think the parser consider that as text. It works if you do:
<span>x@(Model.Quantity)</span>
精彩评论