I have some checkBox in my page,

I want that the user checked maximum data but no more,

how can I cancel the select option.

here is my code:

PHP Code:
protected void CheckBox2_CheckedChanged(object senderEventArgs e)
    {
        
int select 0;
        
int max =3;
        if (
max 0)
        {
            for (
int i 0checkBoxGrid.Items.Counti++)
            {
                
CheckBox cb = (CheckBox)checkBoxGrid.Items[i].FindControl("CheckBox1");
                if (
cb.Checked)
                {
                    
select++;
                    if (
max == select)
                    {
                      
//HERE I WANT TO CANCEL
              
                    
}
                }
            }
        }
      
    } 
thanks!