KiddoDeveloper
KiddoDeveloper

Reputation: 628

List value not populating in table in ASP.NET MVC

I am trying to learn ASP.NET MVC. I have created a .NET fiddle example. This is the URL:

https://dotnetfiddle.net/R9eldA

I can not see ID and Name value in the table.

Upvotes: 0

Views: 66

Answers (1)

Victor
Victor

Reputation: 8925

Seems like typo error. Just change to:

@foreach (var report in Model.Reports)
{                           
    <tr>        
        <td>@report.Id</td>                                
        <td><a href="#">@report.Name</a></td>
    </tr>
}

About the @ symbol see the following description from the Microsoft documentation:

Razor supports C# and uses the @ symbol to transition from HTML to C#. Razor evaluates C# expressions and renders them in the HTML output.

Upvotes: 2

Related Questions