title: iterating through rows of a datagrid
body: <p>I am trying to extract values from a datagrid, by iterating through all the rows of the datagrid</p>
  
  <pre><code>    foreach (DataRow drv in PGIPortfolio.Items)
      {
      // DataRow row = drv.Row;
  
      string acname = drv["Portfolio"].ToString();
  string paramt = drv["Par Amount"].ToString();
  MessageBox.Show(acname);
  </code></pre>
  
  <p>}</p>
  
  <p>But it is giving me an InvalidCastException at DataRow drv.
  Could someone tell me what changes I should make so it works? 
  The datagrid has a binding, and it is being populated by a stored procedure from ms sql 2008 database</p>