Click here to Skip to main content
       

ASP.NET

 
QuestionProblem with foreach loop in MVC 3 Razor View Pinmembersolomon20114-Nov-12 4:09 
I have a loop in my razor view as
below
@foreach(var inmate in Model)
{
@inmate.inmateid
@inmate.inmateid
}
My Model is an IEnumerable of inmates
containing 2 inmate objects. But the
result I am getting in my browser is
6
6
7
7
Instead of
6
7
Please can someone tell me why this is
the case?
Thanks
AnswerRe: Problem with foreach loop in MVC 3 Razor View Pinmembern.podbielski14-Nov-12 6:34 
GeneralRe: Problem with foreach loop in MVC 3 Razor View Pinmembermayankgupta68828-Nov-12 15:28 
GeneralRe: Problem with foreach loop in MVC 3 Razor View Pinmembern.podbielski29-Nov-12 6:22 
AnswerRe: Problem with foreach loop in MVC 3 Razor View Pinmembervicent estevan19-Nov-12 2:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web02 | 2.8.140827.1 | Last Updated 29 Aug 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid