title: Create table using two dimensional array
body: <p>How can I fill a table with items in a list collection(item: Year), using a two dimensional array? The list collection was populated by an external database using linq queries.   </p>
  
  <p>ViewModel</p>
  
  <pre><code>public class TableViewModel
  {       
      public List&lt;MovieViewModel&gt; Movies { get; set; }        
      public MyViewModel[,] MovieValues { get; set; }   
  }
  
  public class MyViewModel
  {
      public string MovieValue { get; set; }        
  }
  
   public class MovieViewModel 
  {
      public string Id { get; set; }        
      public string Name { get; set; }
      public string Year { get; set; }   
  }
  </code></pre>
  
  <p>Controller</p>
  
  <pre><code>TableViewModel item;
  item=new TableViewModel();  
  var AllMuvees = from d in db.MoviesTable     
            orderby d.Id                                            
            group d by d.Rating into  M                          
            select M;
  
  List&lt;MovieViewModel&gt; OldMovies;
  foreach (var a in M.AllMuvees)
  {
   OldMovies.Add(new MovieViewModel()
   { 
      Id = g.MovieId.ToString(),
      Name =g.MovieName,
      Year = g.MovieYear.ToString()
   });
  }
  
  
  for (int i = 0; i &lt; 10; i++)
   {
   for (int j = 0; j &lt; 10; j++)
    {
      item.MovieValues[i, j] = new MyViewModel()
      { MovieValues = ***** 
  (I need help here: I want to fill this with the Years from OldMovies)};      
     }
    }
  
   return View(item);
  </code></pre>