我需要使用'forumChild'類更改<div>
標記的CSS類。它必須改變foreach循環的每3個循環。有條件地更改剃刀視圖中的CSS類
有沒有辦法從控制範圍內做到這一點?
<div class="Forum">
<p>The Forum</p>
@foreach (var item in Model)
{
<div class="ForumChild">
<img src="@item.Blog.Image.img_path" alt="Not Found" />
<br />
@foreach (var comment in item.Blog.comment)
{
var db = new ACapture.Models.ACaptureDB();
var Name = from p in db.Profile.AsEnumerable()
where (p.AccountID == comment.AccountID)
select p;
<section>
<div>
<a href="@Url.Action("Index", "Home")">@foreach (var y in Name)
{ @(y.FirstName + " " + y.LastName + ":");
}</a>
</div>
<div>
@comment.Commentation
</div>
</section>
}
</div>
}
</div>
在此先感謝
如果我有多個calsses,除了2,我能在這裏做什麼? – 2016-10-10 10:55:50