How can I count the selected CheckBox from gridview
<p>In my grid I have check boxes and I have a button out side the grid. When I click on the button I want to get the count of only selected rows with check boxes in the grid. How can we do that?  </p>

<p>In my grid view dynamically create check box and another columns, I have site id column, I need to get the site id what are the check box checked.</p>

<p>I use this coding</p>

<pre><code>int count = dataGridView1.Rows.Count;
for (int i = 0; i &lt; count; i++)
{
   int j = dataGridView1.SelectedCells[i].RowIndex;
   clsSaveStatic.SiteID = int.Parse(dataGridView1.Rows[j].Cells[1].Value.ToString();
}
</code></pre>

<p>It returns finally Which check box is checked .
But my requirement is all the checked values i need one by one.</p>
