I just downloaded the MVC 3.0 RC and I'm excited to start using it, especially the Razor view engine. However, due to a few stick in the mud type people here, we are stuck using VB.NET instead of C#.
When I started trying it out, I noticed some quirks. If you are creating a Razor view using CSHTML, you can write code like this:
@foreach(string genreName in Model.Genres)
{
<li>@genreName</li>
}
Razor will automatically detect that the <li>
text is an HTML tag and will switch out of "code mode". With a VB.NET VBHTML file, this doesn't seem to be working. It's making me put the @:
keyword in front of each line like this:
@For Each genreName As String In Model.Genres
@:<li>@genreName</li>
Next
If I don't have it there, I get a runtime error. Also, the <text></text>
tags don't seem to work.
Anybody know what's going on here or whether there's a workaround?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…