title: Trying to populate a table using repeaters
body: <p>I'm trying to populate a table using a database. I've been trying to follow numerous examples but to no avail. I feel like I'm missing something fundamental as this should be this hard... Thanks.</p>
  
  <pre><code>    &lt;table&gt;
          &lt;asp:Repeater ID="rpt" runat="server"&gt;
              &lt;HeaderTemplate&gt;
                  &lt;tr&gt;
                      &lt;th&gt;&lt;/th&gt;
                  &lt;/tr&gt;
              &lt;/HeaderTemplate&gt;
              &lt;ItemTemplate&gt;
                  &lt;tr&gt;
                      &lt;td&gt;
                          &lt;asp:Label ID="data" runat="server" Text='&lt;%= string.Format("{0}", My_Variable) %&gt;' /&gt;
                      &lt;/td&gt;
                  &lt;/tr&gt;
              &lt;/ItemTemplate&gt;
          &lt;/asp:Repeater&gt;
      &lt;/table&gt;
  </code></pre>
  
  <p>C#</p>
  
  <pre><code>   protected void Page_Load(object sender, EventArgs e)
      {
          SqlConnection Conn = new SqlConnection(ConfigurationManager.ConnectionStrings["_connectionString"].ConnectionString);
          SqlDataAdapter adapter = new SqlDataAdapter("SELECT * FROM Customer", Conn);
          DataTable table = new DataTable();
          adapter.Fill(table);
          rpt.DataSource = table;
          rpt.DataBind();
      }
  
      private void rpt_ItemDataBound(object sender, RepeaterItemEventArgs e)
      {
          //if (e.Item.ItemType == 
          Label l = (Label)e.Item.FindControl("data");
          l.Text = e.Item.DataItem.ToString();
      }
  </code></pre>