title: Passing a Value from a ViewBag to a partial View
body: <p>So my Controller's code is as follows:</p>
  
  <pre><code>private CommunityModelsContext dbCommunities = new CommunityModelsContext();
  
  // GET: /Home/
  public ActionResult Index()
  {
       //retrieve the Communities 
       ViewBag.Communities = dbCommunities.Communities.ToList();
       return View();
  }
  </code></pre>
  
  <p>And my View has this all important line to start the Partial View</p>
  
  <pre><code>&lt;div id="LeftView" class="PartialView"&gt;@{Html.RenderPartial("CommunitiesPartial");}&lt;/div&gt;
  </code></pre>
  
  <p>and in the Partial view, I'm trying to create a DropDownList (I'm still learning, this is a practice app just to see if I've understood the concepts from the asp.net tutorial), that will then take this List of entities, display one field, gets the value from the Other ("Name" and "id")</p>
  
  <pre><code>@model BuildingManagement.Models.Community.Community
  
  @Html.BeginForm("Index","CommunityController")
  {
      &lt;div&gt;
          @Html.LabelFor(x =&gt; x.Name)
          @Html.DropDownList("Community" , new SelectList(Model.Name,"id","Name"))
      &lt;/div&gt;
  }
  </code></pre>
  
  <p>Now this throws a NullReference Exception, the model is null.  There is no model in the Index page and it is not bound to anything, however, the data is being sent through the ViewBag.</p>
  
  <p>Ideas please?</p>