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

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

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

asp.net mvc - breakpoint on javascript in CSHTML? -