learning
learning

Reputation: 11725

display array of arrays in mvc

How do I display the foolowing in my view?

I am having a class as follows:

public class testArrays()
{ public list<int>ID{get;set;}
public int TotalAccount{get;set;}
public List<int> Account{get;set;}
}
public List<testArrays> test {get;set;}

How can I displat the values of test in my view?  Part of my code is as follows:
foreach(var i in model.test)
{
foreach(var j in i)<-----stuck as from here
{

}

}

Upvotes: 0

Views: 164

Answers (1)

RPM1984
RPM1984

Reputation: 73122

Same way you do any nested loop. Unless im missing something?

foreach(var i in model.test) // i is "testArrays"
{
    foreach(var x in i.ID) // x is "int"
    {
       // ..
    }
}

A better way would be to use custom display templates.

Upvotes: 2

Related Questions