title: Entity Framework, Multiple values 1 cell/ Datagridview c#
body: <p>I have a datagridview and I need to somehow have 2 values in my database in the same cell.</p>
  
  <p>I need to have 2 checkboxes in the same column which are currently smallints in the database.</p>
  
  <p>I am using entity framework if that helps?</p>
  
  <p>Also I need to be able to store these values back to the database!</p>
  
  <p>I'm not entirely sure where to start so any pointers would be brilliant!</p>
  
  <p>Code is a basic EF with a DataBindingProjection class,</p>
  
  <pre><code>    private void HtReports_Load(object sender, EventArgs e)
      {
          dataGridView1.DefaultCellStyle.WrapMode = DataGridViewTriState.True;
          dataGridView1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells;
  
          fmsEntities context = new fmsEntities();
          var query = (from f in context.funerals
                      where f.IsPencil == 0
                      join d in context.deceaseddetails on f.DeceasedID equals d.ID
                      join i in context.funeralservices on f.ID equals i.FuneralID
                      where i.IsAlternative == 0
                      join h in context.htvalues on f.HtValuesID equals h.ID
                      join p in context.placeofdeaths on f.PlaceOfDeathID equals p.ID
                      join c in context.coroners on f.CoronerID equals c.ID
                       let val1 = d.DateOfDeath
                       let val2 = d.DateOfBirth
                       let val3 = i.Date
                       orderby i.Date
                       select new
                       {
                           d.LastName,
                           d.FirstName,
                           val2,
                           val1,
                           f.CremOrInt,
                           FormsSigned1 = h.FormsSigned1 ?? 0,
                           FormsSigned2 = h.FormsSigned2 ?? 0,
                       }).ToList();
  
          var dataobjects = query.Select(d =&gt; new DataBindingProjection
          {
              DeceasedName = (d.FirstName + Environment.NewLine + d.LastName),
              DOBDOD = (d.val2.HasValue ? d.val2.Value.ToShortDateString() : string.Empty) + Environment.NewLine +
              (d.val1.HasValue ? d.val1.Value.ToShortDateString() : string.Empty),
              CremInt = d.CremOrInt
          }).ToList();
  
          dataGridView1.DataSource = dataobjects;
  
          dataGridView1.Columns[0].HeaderText = "Last Name" + Environment.NewLine + "First Name";
          dataGridView1.Columns[1].HeaderText = "DOB" + Environment.NewLine + "DOD";
          dataGridView1.Columns[2].HeaderText = "Crem/Int";
      }
  
  
      private class DataBindingProjection
      {
          public string DeceasedName {get; set;}
          public string DOBDOD {get; set;}
          public string CremInt { get; set; }
      }
  </code></pre>