TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Cassie Mod
NA
488
70.5k
foreach loop doesn't know [i]
Feb 4 2016 3:57 AM
HI,
Ive got the following easy question.
I had a for loop, however when i set it in a foreach loop it doesn;t know "[I] . How can i fix this???
for lop:
@for (int i = 0; i < 2; i++)
{
<div class="col-lg-2 col-xs-2 col-sm-2 col-md-2">
@Html.Partial("_CollectorStatusOne", Model.CollectorStatus.FirstOrDefault(cs => cs.CollectorID == Model.Collectors.ToList()[i].CollectorID))
</div>
}
foreach loop:
@foreach (var item in Model.Collectors)
{
<div class="col-lg-2 col-xs-2 col-sm-2 col-md-2">
@Html.Partial("_CollectorStatusOne", Model.CollectorStatus.FirstOrDefault(cs => cs.CollectorID == Model.Collectors.ToList()[i].CollectorID))
</div>
}
Reply
Answers (
7
)
why we use abstract class
Measure request/response times of an Asp.Net MVC application