Hello there,
How can i get specefic records from a list inside the view in asp.net mvc
This my model code :
public class FFResult
{
public FDoneTest Page { get; set; }
public List<FResult> ResultList { get; set; }
public List<JobArticle> ArtList { get; set; }
}
I have a foreach for "ResultList" in my view and another one inside it for "ArtList", What i want to do is displaying the records from "ArtList" that is related to that specific record from "ResultList"
That is what i've tried and it returns null :
@foreach (var item in Model.ResultList)
{
List<Kafo.Models.JobArticle> one = Model.ArtList.Where(x => x.ExamSecId == item.id).ToList();
<div id="demo-@item.id" class="collapse" style="padding-top:20px;">
<ul style="text-align:right;direction:rtl;">
@foreach (var items in one)
{
<li style="font-size:18px;">
<a href="#" style="text-decoration:none;" onclick="location.href='@Url.Action("JArticle", "Article", new { Controller = "Article", Action = "JArticle", id = item.id })'">@items.Name</a>
</li>
}
</ul>
</div>
<hr />
}