x@Model.Quantity" />
开发者

MVC Razor context commutation problem

开发者 https://www.devze.com 2023-01-30 14:03 出处:网络
I\'m trying to output a \"x3\" string with value stored in my model. <span>x@Model.Quantity</span>output => x@Model.Quantity

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>
0

精彩评论

暂无评论...
验证码 换一张
取 消