c# - Using linq with dynamic model in Razor View -
using dynamic model on mvc page , attempting use linq "skip" , "take" in each loop.
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
Post a Comment