c# - Using linq with dynamic model in Razor View -


using dynamic model on mvc page , attempting use linq "skip" , "take" in each loop.

however, every time error: enter image description here

my code this:

@model dynamic @foreach (var article in model.articles.take(2))     {         <div class="col-md-4">             <a href='@url.action("details", "content", new { id = article.id }, null)'>                 <img class="img img-responsive" src="@(article.imageurl)" />             </a>             @article.title         </div>     } 

thanks

since take extension method, need include namespace using system.linq

in mvc razor, @using system.linq


Comments

Popular posts from this blog

php - Passing multiple values in a url using checkbox -

compilation - PHP install fails on Ubuntu 14 (make: *** [sapi/cli/php] Error 1) PHP 5.6.20 -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -