title: Binding List to GridView
body: <p>I have a list of credit card objects.  The credit card class is the following:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  
  namespace Client
  {
      public class CreditCard
      {
          public String A_Number;
          public String A_Name;
          public String A_Type;
          public String A_Owner_Type;
          public String Bank_City;
          public String Bank_State;
          public String Bank_ZIP;
          public String Balance;
          public String C_Username;
  
          public CreditCard()
          {
  
          }
      }
  }
  </code></pre>
  
  <p>In another class, I am trying to bind the list to a grid view as follows:</p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
          {
              List&lt;CreditCard&gt; list = (List&lt;CreditCard&gt;)Session["list"];
              GridView_List.DataSource = list;
              GridView_List.DataBind();
          }
  </code></pre>
  
  <p>However, I am receiving the following error:</p>
  
  <pre><code>The data source for GridView with id 'GridView_List' did not have any properties or attributes from which to generate columns.  Ensure that your data source has content.
  </code></pre>
  
  <p>What is the problem?  I checked that the list actually contains data so I don't know why it won't work?  How can this problem be solved?</p>