Click here to Skip to main content
15,893,486 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear All,

How to get a value from CheckBox from DataGridView and check it as true or false
Posted

One way discussed here[^].

Some other links -
Here [^]
and
here[^].
 
Share this answer
 
v2
C#
CheckBox chk = new CheckBox();
chk  = (CheckBox)gatagrid.Rows[0].Cells[0].FindControl["chkId"];
if(chk.Checked == true){
}
 
Share this answer
 
Hi,

Get the value for that column and check its true (or) false.

Try the following Code...
for(int x=0;x<dgvView.Rows.Count;x++)
{
  if(dgvView.Rows[x].Cells["CheckBoxColumn"].Value.ToString().Equals("true"))
 {
   //Your Code
 }
             (or)
if(Convert.ToBoolean(dgvView.Rows[x].Cells["CheckBoxColumn"].Value.ToString()))
{
   // Your Code
}
}


Cheers :)
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900