1
Answer

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

Mamta Jain

Mamta Jain

7y
218
1
 
 
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)