Home > Back-end >  List value not populating in table in ASP.NET MVC
List value not populating in table in ASP.NET MVC

Time:06-13

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.

CodePudding user response:

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.

  • Related