开发者

pref@item.Id is content with razor, I need it code

I'm doing something like

@foreach (var item in Model)
<li id='pref@item.Id' >
..

the problem is that it's rendered as content '开发者_C百科pref@item.Id' the item.Id is not evaluated, anybody knows a way out of this ?


Razor thinks you're trying to render an email address. Try one of these two approaches:

<li id='pref@(item.Id)'>

<li id='<text>pref</text>@item.Id'>

See this handy quick reference by Phil Haack for more tips:

http://haacked.com/archive/2011/01/06/razor-syntax-quick-reference.aspx

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜