title: MVC Form DropDownListFor
body: <p>In my view I am building a form where the user select a country from a list of Countries.I get this error about Object reference not set to an instance of an object. Is there anything I am missing?</p>
  <pre><code>                    @Html.DropDownListFor(
                              x =&gt; x.selectedCountryId,
                              new SelectList(Model.ListOfCountries, &quot;Value&quot;, &quot;Text&quot;),
                              &quot;-- please select a Country--&quot;,
                              new { id = &quot;ddlCountry&quot;, @class = &quot;form-control&quot; }
                      )
                      @Html.ValidationMessageFor(x =&gt; x.selectedCountryId)
  </code></pre>
  <p>Model</p>
  <pre><code> [Required]
          public int? selectedCountryId{ get; set; }
  </code></pre>
  <p>Error</p>
  <pre><code>System.NullReferenceException: 'Object reference not set to an instance of an object.'
  
  System.Web.Mvc.WebViewPage&lt;TModel&gt;.Model.get returned null.
  </code></pre>
  <p>Action Method</p>
  <pre><code> public ActionResult Create(RequestFormViewModel model)
          {
              if (!ModelState.IsValid)
              {
                  
              }
  
              return View(TemplateName, &quot;&quot;);
  
      public ActionResult Index()
      {
          RequestFormViewModel  result = new RequestFormViewModel ();
  
          try
          {
              var FormInfo = GetFormInfo();
  
              if (FormInfo != null)
              {
                  result = FormInfo;
  
  
              }
          }
          catch (Exception e)
          {
  
          }
  
          return View(TemplateName, result);
      }
  </code></pre>