title: binding a GridView to a List in asp.net c#
body: <p>This is the first time that I'm doing this, so I need a little bit of help,</p>
  
  <p>I have this code behind:</p>
  
  <pre><code>List&lt;Trucks&gt; FinalListOfTrucks = new List&lt;Trucks&gt;();
      public class Trucks
      {
          public string Placa;
          public string Lock;
          public string Event;
          public DateTime Date;
          public string TipoCamion;
          public string Person;
          public string MissedDate;
      }
  
      protected void btnProcess_Click(object sender, EventArgs e)
          {
              Trucks item = new Trucks();
              item.Placa = "MA2323";
              item.Lock = "lock1";
              item.Event = "Event1";
              item.Date = DateTime.Now;
              item.TipoCamion = "TRUCK1";
              item.Person = "JULIAN";
              item.MissedDate = "";
              FinalListOfTrucks.Add(item);
  
              gvOriginal.DataSource = FinalListOfTrucks;
              gvOriginal.DataBind();
  }
  </code></pre>
  
  <p>in design:</p>
  
  <pre><code>&lt;asp:Button ID="btnProcess" runat="server" Text="Process" 
          onclick="btnProcess_Click" /&gt;
      &lt;asp:GridView ID="gvOriginal" runat="server"&gt;&lt;/asp:GridView&gt;
  </code></pre>
  
  <p>But trying to run the web app, I'm getting the following error:</p>
  
  <p><code>The data source for GridView with id 'gvOriginal' did not have any properties or attributes from which to generate columns.  Ensure that your data source has content.</code></p>
  
  <p>Do I have to do anything else, to make this work?</p>