에서 페이지에 partialview 또는 뷰에 짝수와 홀수 vlaue alternativelty을 인쇄하는 방법을 나는 왼쪽 이미지 & 내용과 오른쪽 이미지 & 내용에 대한 두 개의 HTML을 가지고있다. 가치있는 인쇄. 내가 무엇을 쓸 수있는 각각의 루프 홀수 및 짝수 값을 페이지의 부분보기에서 모델에서 인쇄합니다.
@inherits UmbracoViewPage<List<ProjectName.Models.DealerSectionModel>>
@using ProjectName.Models;
@using Umbraco.Core;
@{
foreach (DealerSectionModel historylist in Model) // what should i write in this loop .(ex if 1 value in model then print odd html)
{
if()
{
@RenderEvenHistoryList(historylist)
}
else
{
@RenderOddHistoryList(historylist)
}
}
}
@helper RenderOddHistoryList(DealerSectionModel item)
{
<div class="row history-second-section py-2 py-xl-4 py-lg-4 py-md-4 py-sm-2">
<div class="col-12 col-xl-6 col-lg-6 col-md-6 col-sm-12 history-second-images">
<div class="quote my-3"><iframe src="@item.VideoUrl" width="510" height="282" frameborder="0" allowfullscreen></iframe></div>
</div>
<div class="col-12 col-xl-6 col-lg-6 col-md-6 col-sm-12 history-second-content">
<div class="content-year">@item.Title </div>
<h4>@item.ImageTitle</h4>
<p>@item.ImageDescription</p>
</div>
</div>
}
}
@helper RenderEvenHistoryList(DealerSectionModel item)
{
// render html for even model value
}
}
감사합니다! –