I have a GridView populated from an XML file. I have added an id=chkRow column to this list. There are over 100 records/rows.

What I want to do ultimately is limit the number of rows/checkboxes that the user can click to three.

I have successfully figured out how to increment an integer everytime a checkbox is changed - but it keeps incrementing even if I uncheck. 

So now, what I want to do is increment when the selected row is Checked=true, and decrease when Checked=false. 

I am unable to figure out how to get the checked state of the checkbox that was just clicked. 

This code throws a NullReferenceException when I click on any checkbox.

```
protected void MyCheckBoxes_SelectedIndexChanged(object sender, EventArgs e)
        {  
             CheckBox chk1 = (CheckBox)GridView1.HeaderRow.FindControl("chkRow");
                Label1.Text = mycount.ToString();
                if(chk1.Checked == true)

                       {
                           Increment();
                       }

        }

```