Mamta Jain

Mamta Jain

  • NA
  • 417
  • 13.6k

Not getting the value of Data grid view's check box status

Dec 15 2016 2:01 AM
 
 
I have a grid view in which 3 columns have been added of check boxes .
but when I check the value as it check box is check or unchecked its every time gives false value .
My question is how can i get the state of checkboxes .
My code :
 
public string user_rights()
{
string msg = "";
int add = 0;
int delete = 0 ;
int view = 0 ;
foreach (DataGridViewRow dgvr1 in DGV.Rows)
{
if (dgvr1.Cells[0].Value.ToString() == "True")
{
add = add + 1;
}
if (dgvr1.Cells[1].Value.ToString() == "True")
{
delete = delete + 1;
}
if (dgvr1.Cells[2].Value.ToString() == "True")
{
view = view + 1;
}
}
if(add == 0 && delete == 0 && view == 0 )
{
msg = "Select atleast one user rights" ;
}
return msg;
}
 
 
 
 

Answers (1)