开发者

display array of arrays in mvc

开发者 https://www.devze.com 2023-03-25 17:24 出处:网络
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;}

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 Total开发者_Python百科Account{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
{

}

}


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消