lundi 27 avril 2015

display three random articles in a partial view mvc

I have a blog in which I display a partialview in that partial I am trying to display three random similar articles. However I am abit stuck with the syntax:

@{for (int i = 0; i < 3; ++i)
    {
     foreach (var item in Model)
     {
    <p class="text-left">Similar Article: <a href="@Url.Action("Details", "Post", new { urlslug = item.UrlSlug })">@Html.DisplayFor(modelItem => item.Title)</a></p>
      }
    }

}




Aucun commentaire:

Enregistrer un commentaire