title: Virtual Field Null when Updating Table
body: <p>I have a virtual field in my data model, for a parent table.  When updating the table the model state is invalid because the virtual &quot;Aircraft&quot; field is null.</p>
  <p>Is this normal behaviour, I would have expected the virtual field to be ignored?  How can I avoid this error?</p>
  <p>Razor:</p>
  <pre><code> public async Task&lt;IActionResult&gt; OnPostCreate([DataSourceRequest] DataSourceRequest request, Models.FlightLog flightLog)
      {
          if (flightLog != null &amp;&amp; ModelState.IsValid)
          {
              try
              {       
                  _context.Add(flightLog);
                  await _context.SaveChangesAsync();
  
              }
              catch (Exception)
              {
                  // TODO: fix error handling
              }
          }
          return new JsonResult(await new[] { flightLog }.ToDataSourceResultAsync(request, ModelState));
      }
  </code></pre>
  <p>Model:</p>
  <pre><code>public class FlightLog
      {
          public int FlightLogID { get; set; }
  
          [Display(Name = &quot;Date&quot;)]
          [DataType(DataType.Date)]
          public DateTime FlightDate { get; set; }
  
          [Display(Name = &quot;Aircraft&quot;)]
          [ForeignKey(&quot;Aircraft&quot;)]
          public int AircraftID { get; set; }
  
          public decimal FlightTime { get; set; }
  
          public int Starts { get; set; }
  
          public int Landings { get; set; } 
         
          public virtual Aircraft Aircraft { get; set; }
      }
  </code></pre>
  <p>Page:</p>
  <pre><code>@(Html.Kendo().Grid&lt;FlightLog.Models.FlightLog&gt;()
      .Name(&quot;Grid&quot;)
      .Columns(columns =&gt;
      {
          columns.Bound(p =&gt; p.FlightLogID).Visible(false);
          columns.Bound(p =&gt; p.FlightDate);
          columns.ForeignKey(p =&gt; p.AircraftID, @Model.Aircraft , &quot;AircraftID&quot;, &quot;Registration&quot;).Title(&quot;Aircraft&quot;).EditorTemplateName(&quot;ComboBox&quot;);
          columns.ForeignKey(p =&gt; p.PersonID, @Model.Person , &quot;PersonID&quot;,
          &quot;FullName&quot;).Title(&quot;Pilot&quot;).EditorTemplateName(&quot;ComboBox&quot;);
          columns.Bound(p =&gt; p.Client);
          columns.Bound(p =&gt; p.FlightTime).Format(&quot;{0:n1}&quot;);
          columns.Bound(p =&gt; p.Starts); //.EditorTemplateName(&quot;Int32&quot;);
          columns.Bound(p =&gt; p.Landings);
          columns.Bound(p =&gt; p.POB);
          columns.Bound(p =&gt; p.TaskNumber);
            columns.Command(commands =&gt;
              {
                  commands.Edit(); // The &quot;edit&quot; command will edit and update data items.
                  commands.Destroy(); // The &quot;destroy&quot; command removes data items.
              }).Title(&quot;Commands&quot;).Width(200);
      })
        .ToolBar(tools =&gt;
      {
          tools.Create().Text(&quot;New&quot;);
      })
      .Editable(editable =&gt; editable.Mode(GridEditMode.PopUp).TemplateName(&quot;MyFlightLog&quot;).AdditionalViewData(new {indexModel = @Model}))
      .Pageable()
      .Sortable()
      .Filterable()
      .DataSource(dataSource =&gt; dataSource
            .Ajax()
          .PageSize(15)
          .Model(model =&gt;
          {
              model.Id(p =&gt; p.FlightLogID);
      @*            model.Field(p =&gt; p.AircraftID);
              model.Field(p =&gt; p.PersonID);*@
          })
          .Read(r =&gt; r.Url(Url.Page( &quot;./Index&quot;,&quot;Read&quot;)).Type(HttpVerbs.Post))
          .Create(c =&gt; c.Url(Url.Page(&quot;./Index&quot;, &quot;Create&quot;)).Type(HttpVerbs.Post))
          .Update(u =&gt; u.Url(Url.Page(&quot;./Index&quot;, &quot;Update&quot;)).Type(HttpVerbs.Post))
          .Destroy(u =&gt; u.Url(Url.Page(&quot;./Index&quot;, &quot;Destroy&quot;)).Type(HttpVerbs.Post))
       )
  )
  </code></pre>