title: Pass List<string> from ActionResult to partialview
body: <p>I have a <code>ActionResults</code> and I want to pass a list string to a <code>partialview</code>, but I just cannot work out how to do it.</p>
  
  <p>Hopefully someone a lot cleverer :-) than me can help me solve it.</p>
  
  <pre><code>namespace Web.UI.Controllers
  public ActionResult Index()
  {
      return View();
  }
  
  public async Task&lt;ActionResult&gt; Test()
  {
      var currentConditions   = await Task.Run(()=&gt; _IGWC.CurrentConditions("194.61.173.5").FirstOrDefault());
      var weatherAstronomy    = await Task.Run(()=&gt; _IGWC.WeatherAstronomy("194.61.173.5").FirstOrDefault());
      var weatherConditions   = await Task.Run(()=&gt; _IGWC.WeatherConditions("194.61.173.5").FirstOrDefault());
      var weatherLocation     = await Task.Run(()=&gt; _IGWL.WeatherSearch("194.61.173.5").FirstOrDefault());
  
      string test      = currentConditions.feelsLikeC.ToString();
      string test1     = weatherAstronomy.sunRise.ToString();
      string test2     = weatherConditions.maxtempC.ToString();
      string test3     = weatherLocation.DisplayAreaName.ToString();
  
      List&lt;string&gt; weatherData = new List&lt;string&gt;();
      weatherData.Add(test);
      weatherData.Add(test1);
      weatherData.Add(test2);
      weatherData.Add(test3);
  
      return PartialView(weatherData);
  }
  </code></pre>
  
  <p>In my index view which contains the partialview I have:</p>
  
  <pre><code>@{Html.Partial("Test","Home");}
  </code></pre>
  
  <p>And finally in my partialview I have tried using the following.</p>
  
  <pre><code>What goes here
  
  @foreach (var item in Model)
  {
  @item.
  }
  </code></pre>
  
  <p>How can I get the values from <code>weatherData</code> and pass to partialview, the only way I have found for it to work is using tempdata, but I do not want to go down that route.</p>
  
  <p>---------------------------Code Update----------------------</p>
  
  <p>In index view I have put the following as requested:</p>
  
  <pre><code>  @model System.Collections.Generic.List&lt;string&gt;
  
  @{Html.Partial("Test", Model);}
  </code></pre>
  
  <p>In partialview I have the following:</p>
  
  <pre><code>@model System.Collections.Generic.IEnumerable&lt;string&gt;
  
  
  &lt;ul&gt;
  @foreach (var item in Model)
  {
      &lt;li&gt;@item&lt;/li&gt;
  }
  &lt;/ul&gt;
  </code></pre>
  
  <p>This now results in the following error:</p>
  
  <p>Message=Object reference not set to an instance of an object. caused by @foreach (var item in Model)</p>