Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

DisplayForModel is not working for List ?

$
0
0

Hi everybody !

I work with ASP.NET 5 RC1.

I would like to use DisplayForModel to show  the content of the list.

I have this code :

@model IEnumerable<CoordonneeViewModel><table class="table table-bordered table-striped table-hover"><thead><tr><th class="col-md-2">Name1</th><th class="col-md-2">Name2</th></tr></thead><tbody>
        @{
            @Html.DisplayForModel("Coordonnee")
        }</tbody></table>

And this code in DisplayTemplates/Coordonnee.cshtml :

@model CoordonneeViewModel<tr><td>@Model.Name1</td><td>@Model.Name2</td></tr>

I know that this code works in ASP.NET MVC 5 but not here. And I don't know why ! I tried DisplayFor also but same problem.

Anybody can help me ?

Thanks !

Greg


Viewing all articles
Browse latest Browse all 9386

Trending Articles