title: asp.net mvc. Passing a list via viewData
body: <p>Hi does anyone know how to pass a list throught the "ViewData".  This is what I'm trying but I think I'm missing a cast some where.</p>
  
  <pre><code>List&lt;GalleryModel&gt; galleryList = new List&lt;GalleryModel&gt;();
          galleryList.Add(new GalleryModel() { isApproved = true, uri = "www.cnn1.com" });
          galleryList.Add(new GalleryModel() { isApproved = true, uri = "www.cnn2.com" });
  
          ViewData["SomeList"] = galleryList;
  </code></pre>
  
  <p>here's my aspx page code:</p>
  
  <pre><code> &lt;% List&lt;myNS.CM.AVDTalentApplication.Models.GalleryModel&gt; galList = ViewData["SomeList"];  %&gt;
  &lt;% foreach (var gal in galList) { %&gt;
  &lt;%= gal.uri%&gt;
  &lt;%} %&gt;
  </code></pre>