title: I keep getting a null entry when passing data from view to view Asp.net mvc?
body: <p>I'm trying to pass data between views and I keep getting a null value when I try to pass it through. </p>
  
  <p>All I want is for the actionlink from "contractordetails" view to pass its contractorid on the page to the next view "contractorrequest" so it can be displayed.</p>
  
  <p>The UserId and User Name is working I just keep getting an error as shown below indicating its a null entry.</p>
  
  <p><a href="https://i.stack.imgur.com/HimIg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HimIg.png" alt="enter image description here"></a></p>
  
  <p>Where am I going wrong?</p>
  
  <p>My code:</p>
  
  <pre><code>      @Html.ActionLink(
                         linkText: "Contractor Area",
                         actionName: "ContractorRequest",
                         controllerName: "ConDashboard",
                         routeValues: new {area = "Contractor",id = Model.ContractorId},
                                                       htmlAttributes: null )
  </code></pre>
  
  <p>Controller</p>
  
  <pre><code>    [HttpGet]
      public ActionResult ContractorRequest(ContractorVM model, int contractorid)
      {
  
          int id = model.ContractorId;
  
          var addrequest = new AddCalendarRequestVM();
          addrequest.User = new UserVM();
  
          string username = User.Identity.Name;
  
  
  
          using (Db db = new Db())
          {
  
              UserDTO dto = db.Users.FirstOrDefault(x =&gt; x.Username == username);
  
              addrequest.User = new UserVM(dto);
          }
  
  
  
  
  
          return View("ContractorRequest", addrequest);
      }
  </code></pre>
  
  <p>View </p>
  
  <pre><code>   @using (Html.BeginForm("ContractorRequest", "ConDashboard", FormMethod.Post, new { enctype = "multipart/form-data" }))
                          {
                              @Html.AntiForgeryToken()
  
                          &lt;form class="form-horizontal"&gt;
  
  
  
                              &lt;hr /&gt;
                              @Html.ValidationSummary(true, "", new { @class = "text-danger" })
  
                              &lt;div class="form-group"&gt;
                                  @Html.LabelFor(model =&gt; model.User.UserId, htmlAttributes: new { @class = "control-label col-md-2" })
                                  &lt;div class="col-md-10"&gt;
                                      @Html.EditorFor(model =&gt; model.User.UserId, new { htmlAttributes = new { @class = "form-control", @readonly = "readonly" } })
                                      @Html.ValidationMessageFor(model =&gt; model.User.UserId, "", new { @class = "text-danger" })
                                  &lt;/div&gt;
                              &lt;/div&gt;
  
                              &lt;div class="form-group"&gt;
                                  @Html.LabelFor(model =&gt; model.User.Name, htmlAttributes: new { @class = "control-label col-md-2" })
                                  &lt;div class="col-md-10"&gt;
                                      @Html.EditorFor(model =&gt; model.User.Name, new { htmlAttributes = new { @class = "form-control", @readonly = "readonly" } })
                                      @Html.ValidationMessageFor(model =&gt; model.User.Name, "", new { @class = "text-danger" })
                                  &lt;/div&gt;
                              &lt;/div&gt;
  
                              &lt;div class="form-group"&gt;
                                  @Html.LabelFor(model =&gt; model.Contractor.ContractorId, htmlAttributes: new { @class = "control-label col-md-2" })
                                  &lt;div class="col-md-10"&gt;
                                      @Html.EditorFor(model =&gt; model.Contractor.ContractorId, new { htmlAttributes = new { @class = "form-control", @readonly = "readonly" } })
                                      @Html.ValidationMessageFor(model =&gt; model.Contractor.ContractorId, "", new { @class = "text-danger" })
                                  &lt;/div&gt;
                              &lt;/div&gt;
  </code></pre>