title: Putting null values in object list
body: <p>I have a class for getting data from database and a webform to display them in a gridview. Here is my class:</p>
  
  <pre><code>public class Personel
  {
      dincerelektrnik_AracTakipEntities entity = new dincerelektrnik_AracTakipEntities();
  
      public Personel(int DriverId, string DriverName, string DriverSurname, string DriverPosition, 
          bool DriverGender, string DriverImage, string DriverEmail,string Password, 
          DateTime? DriverBirthDate)
      {
          this.DriverId = driverId;
          this.DriverName = driverName;
          this.DriverSurname = driverSurname;
          this.DriverPosition = driverPosition;
          this.Gender = gender;
          this.DriverImage = driverImage;
          this.DriverEmail = driverEmail;
          this.Password = password;
          this.BirthDate = birthDate;
      }
  
      private int driverId;
      public int DriverId
      {
          get { return driverId; }
          set { driverId = value; }
      }
  
      private string driverName;
      public string DriverName
      {
          get { return driverName; }
          set { driverName = value; }
      }
  
      private string driverSurname;
      public string DriverSurname
      {
          get { return driverSurname; }
          set { driverSurname = value; }
      }
  
      private string password;
      public string Password
      {
          get { return password; }
          set { password = value; }
      }
  
      private DateTime? birthDate;
      public DateTime? BirthDate
      {
          get {
              if (birthDate.HasValue)
                  return birthDate;
              else
                  return DateTime.Now.Date;
          }
          set { birthDate = value; }
      }
  
      private string driverPosition;
      public string DriverPosition
      {
          get { return driverPosition; }
          set { driverPosition = value; }
      }
  
      private bool gender;
      public bool Gender
      {
          get { return gender; }
          set { gender = value; }
      }
  
      private string driverImage;
      public string DriverImage
      {
          get { return driverImage; }
          set { driverImage = value; }
      }
  
      private string driverEmail;
      public string DriverEmail
      {
          get { return driverEmail; }
          set { driverEmail = value; }
      }
  
      public List&lt;Personel&gt; GetAllDrivers() 
      {
          List&lt;Personel&gt; personeller = new List&lt;Personel&gt;();
  
          var drivers = entity.prGetDrivers();
          foreach (var driver in drivers) 
          {
              personeller.Add(new Personel(driver.DriverId, driver.DriverName, driver.DriverSurname,
                  driver.DriverPosition, driver.DriverGender, driver.DriverImage, driver.DriverEmail,
                  driver.Password, driver.DriverBirthDate));
          }
          return personeller;
      }
  }
  </code></pre>
  
  <p>And my gridview:</p>
  
  <pre><code>&lt;asp:GridView ID="GridViewPersoneller" runat="server" AutoGenerateColumns="false"&gt;
              &lt;Columns&gt;
                  &lt;asp:TemplateField HeaderText="Ad/Soyad"&gt;
                      &lt;ItemTemplate&gt;
                          &lt;%#Eval("DriverName") %&gt;&amp;nbsp;&lt;%#Eval("DriverSurname") %&gt;
                      &lt;/ItemTemplate&gt;
                  &lt;/asp:TemplateField&gt;
                  &lt;asp:TemplateField&gt;
                      &lt;ItemTemplate&gt;
                          &lt;%#Eval("DriverEmail") %&gt;
                      &lt;/ItemTemplate&gt;
                  &lt;/asp:TemplateField&gt;
                  &lt;asp:TemplateField&gt;
                      &lt;ItemTemplate&gt;
                          &lt;%#Eval("DriverBirthDate") %&gt;
                      &lt;/ItemTemplate&gt;
                  &lt;/asp:TemplateField&gt;
  
              &lt;/Columns&gt;
          &lt;/asp:GridView&gt;
  </code></pre>
  
  <p>And webform's codebehind:</p>
  
  <pre><code>Personel personel = new Personel(1, "deneme", "deneme", "deneme", true, "deneme", "deneme", "deneme", DateTime.Now.Date);
  
      protected void Page_Load(object sender, EventArgs e)
      {
          FillPeronselGridView();
      }
  
      protected void FillPeronselGridView() 
      {
          List&lt;Personel&gt; personelList = personel.GetAllDrivers();
          GridViewPersoneller.DataSource = personelList;
      }
  </code></pre>
  
  <p>When I run the code, I see nothing. Not an error or a gridview. When I debug, I see that I get all datas with my stored procedure and store them in 'drivers' variable without a problem, but when it comes to add them in object list, it add null values. Why is this happening and how can I solve this. Thank you for your time and support.</p>