Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

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.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading