title: C# - Add new row to a DataGridView
body: <p>I need to add dynamically rows to a <code>DataGridView</code> when I clicked on a button.
  I have read many posts about it but all of these have a <code>DataTable</code> as <code>DataSource</code>. In my case, the <code>DataSource</code> is a <code>List</code> and the rows are custom objects(Product). See the following code:</p>
  
  <pre><code>    List&lt;Product&gt; products = 
      (List&lt;Product&gt;)repository.Session.CreateCriteria&lt;Product&gt;().List&lt;Product&gt;();
      ProductsDataGrid.DataSource = products;
  </code></pre>
  
  <p><code>AllowUserToAddRow</code> is true. So how can I add a row dynamically?</p>
  
  <hr>
  
  <p>As I understand it, based on Nasmi Sabeer's answer I have tried:</p>
  
  <pre><code>    private void addProductBtn_Click(object sender, EventArgs e)
      {
          List&lt;Product&gt; products = (List&lt;Product&gt;) ProductsDataGrid.DataSource;
          products.Add(new Product());
          ProductsDataGrid.DataSource = products;
          ProductsDataGrid.Refresh();   
      }
  </code></pre>
  
  <p>But does not work.</p>