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
精彩评论