title: How can bind data to repeater control in asp.net c#?
body: <p>I am binding data to repeater control from database of company. I am trying to fetch company name from database and want to show as label, but it is not working.</p>
  
  <p>My <code>C#</code> code is:</p>
  
  <pre><code>string conn_string = ConfigurationManager.ConnectionStrings["UPOneConn"].ConnectionString;
  SqlConnection con = new SqlConnection(conn_string);
  con.Open();
  string ComSelectCompanyDataStr = "Select Company_Name from Company_Details where Company_ID = '8' ";
  SqlCommand ComSelectCompanyData = new SqlCommand(ComSelectCompanyDataStr, con);
  SqlDataAdapter da = new SqlDataAdapter();
  da.SelectCommand = ComSelectCompanyData;
  DataTable dt = new DataTable();
  da.Fill(dt);
  
  Repeater1.DataSource = dt;
  Repeater1.Visible = true;   
  con.Close();
  </code></pre>
  
  <p>and my design code:</p>
  
  <pre><code>&lt;div id="company_container"&gt;
          &lt;asp:Repeater ID="Repeater1" runat="server"&gt;
              &lt;HeaderTemplate&gt;
                  &lt;table&gt;
                      &lt;tr&gt;
                          &lt;td&gt;
                              &lt;asp:Label ID="Label1" runat="server"&gt;&lt;%# Eval ("Company_Name") %&gt;&lt;/asp:Label&gt;&lt;/td&gt;
                      &lt;/tr&gt;
                  &lt;/table&gt;
              &lt;/HeaderTemplate&gt;
              &lt;ItemTemplate&gt;
                  &lt;tr&gt;
                      &lt;td&gt;&lt;/td&gt;
                  &lt;/tr&gt;            
              &lt;/ItemTemplate&gt;
              &lt;FooterTemplate&gt;
                  &lt;/table&gt;
              &lt;/FooterTemplate&gt;
          &lt;/asp:Repeater&gt;
      &lt;/div&gt;
  </code></pre>