Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Converting C# Razor to VB

I'm following the ASP.NET MVC Tutorial and having started in VB.NET I'm having trouble converting the following razor code:

enter image description here

I have got

<ul>
    @For Each g As MvcApplication1.Genre In Model
        <li> @g.Name </li>
    Next

</ul>

but getting

Attribute Sepcifier is not a complete statement

on both the <li> tags. I understand I need to use line continuation but can't figure out where. I'd be greatful if you can point out the problem.

like image 836
m.edmondson Avatar asked Feb 28 '11 20:02

m.edmondson


2 Answers

Put an @ before the li:

<ul>
    @For Each g As MvcApplication1.Genre In Model
        @<li>@g.Name</li>
    Next
</ul>

I would recommend you the following article.

like image 57
Darin Dimitrov Avatar answered Oct 16 '22 11:10

Darin Dimitrov


I think your <li> line needs to be prepended with the @: operator based on this stack post:

Razor View Engine Quirks in VB.NET

like image 4
Paul Avatar answered Oct 16 '22 12:10

Paul