title: Asp-Items in HTML Select Razor Pages. Object reference not set to an instance of an object
body: <p>Im trying to get an html select to populate with the code I have so far. And upon loading it keeps telling me &quot;object reference not set to instance of an object&quot; and highlighting the asp=items piece. Why is this happening? I have confirmed the list is indeed populated at the end of the get method, why doesnt the value make it to the page?</p>
  <p>Screen:</p>
  <pre><code>  &lt;div class=&quot;container&quot;&gt;
          &lt;h1 class=&quot;mt-4 mb-3&quot;&gt;
              NYS Courts
              &lt;small&gt;Welcome&lt;/small&gt;
          &lt;/h1&gt;
          &lt;hr /&gt;
  
          &lt;div class=&quot;row&quot;&gt;
              &lt;div class=&quot;col-md-8 mb-4&quot;&gt;
                  &lt;h3&gt;Select Organization&lt;/h3&gt;
                  &lt;br /&gt;
                  &lt;form asp-page=&quot;SelectOrganization&quot; method=&quot;post&quot; name=&quot;SelectOrganizationScreen&quot; id=&quot;SelectOrganizationForm&quot;&gt;
                      &lt;div class=&quot;form-group&quot;&gt;
                                                 &lt;select asp-for=&quot;CourtId&quot; asp-items=&quot;@(new SelectList(Model.OrganizationSelectList,&quot;CourtId&quot;,&quot;CourtName&quot;))&quot; name=&quot;CourtId&quot; id=&quot;CourtId&quot;&gt;
                              &lt;option class=&quot;form-control&quot; value=&quot;&quot;&gt;Choose a Court&lt;/option&gt;
                          &lt;/select&gt;
  
  
                      &lt;/div&gt;
  
                      &lt;button type=&quot;submit&quot;&gt; Submit&lt;/button&gt;
                  &lt;/form&gt;
  
              &lt;/div&gt;
          &lt;/div&gt;
  
  
      &lt;/div&gt;
  </code></pre>
  <p>Razor Code:</p>
  <pre><code>       public void OnGet()
          {
              //user will have the list of courts they have permission to access?
              //Hard coded for now
              var OrgValuePairs = new List&lt;OrganizationSelectDTO&gt;()
              {
                 new OrganizationSelectDTO
                 {
                     CourtID = &quot;2&quot;,
                     CourtName = &quot;Criminal Court&quot;
                 },
                 new OrganizationSelectDTO
                 {
                     CourtID = &quot;3&quot;,
                     CourtName = &quot;Supreme Court&quot;
                 },
                 new OrganizationSelectDTO
                 {
                     CourtID = &quot;4&quot;,
                     CourtName = &quot;Surrogate's Court&quot;
                 }
              };
  
              OrganizationSelectList = OrgValuePairs;
  }
      public class OrganizationSelectDTO
      {
          public string CourtName { get; set; }
  
          public string CourtID { get; set; }
      }
  </code></pre>