title: How to use ViewBag as list in MVC3
body: <p>i need to use ViewBag as list inside another ViewBag and i am not understanding how should i do that.<br>
  here is my code:</p>
  
  <pre><code> List&lt;string&gt; srclist = new List&lt;string&gt;();
              foreach(var item in candidateportfolio)
              {
                  if(item.PortfolioID!=0 &amp;&amp; item.ChandidateID!=0)
                  {
                      string filepath = Server.MapPath("~/ePortfolio/PortFolioContent/" + HobbyDetailID + "/Assignments/Exhb_" + item.PortfolioID + "_" + item.ChandidateID + ".jpg");
                      if (System.IO.File.Exists(filepath))
                      {
                          srclist.Add(filepath);
                      }
                  }
              }
              ViewBag.Thumbnail = srclist;
  </code></pre>
  
  <p>candidateportfolio is an object of the class CandidatePortfolio.<br><br>I fetch the data in the class and check whether its fields are not empty.Then i add the filepath to the list and assign list to Viewbag<br><br></p>
  
  <p>Then in View i use it like this:<br><br></p>
  
  <pre><code> @foreach (var item in ViewBag.Thumbnail as List&lt;string&gt;)
  {   
  &lt;img src="@item" title="Learner:@ViewBag.FirstName" width="150px" height="150px" border="5" style="align:right;margin:10px"/&gt; 
  }
  </code></pre>
  
  <p>Now the problem is i also want to fetch ViewBag.FirstName as list.and i cannot run another list in this.Please tell me how should i do this.</p>