Hi Everyone,
I am used the datagrid in my application. I found problem when setting the allready checked checkbox set to false. I Tried to set the values to cloumn=0,false but its never checked false,Here is my code

if (Convert.ToBoolean (dtgqueselect[2, e.RowIndex].Value) == true || Convert.ToBoolean ( dtgqueselect[2, e.RowIndex].Value) == false )
                           // MessageBox.Show(dtgqueselect[2, e.RowIndex].Value.ToString ());//---here gets the value true
                           dtgqueselect[2, e.RowIndex].Value= false ;
                           //MessageBox.Show(dtgqueselect[2, e.RowIndex].Value.ToString ());//---here gets the value false

Can anybody help me........

What exactly are you trying to do?
Do you want to chage the state of the tick? From true to false in runtime?
Because your code has no sence to checking if the tick is in both states.
Just tell me what exactly would you like to do.


Use this to check the state

Convert.ToBoolean(dtgqueselect.Rows[e.RowIndex].Cells[2].FormattedValue) == true

You can also check like this

if(dtgqueselect.Rows[e.RowIndex].Cells[2].Value.ToString()=="True" || dtgqueselect.Rows[e.RowIndex].Cells[2].Value.ToString()=="False")

yes i want to change the state of the tick? From true to false in runtime?

if (Convert.ToBoolean (dtgqueselect[2, e.RowIndex].Value) == true )
dtgqueselect[2, e.RowIndex].Value) =false

but its not working

Edited 5 Years Ago by bhagawatshinde: n/a

dtgqueselect.Rows[e.RowIndex].Cells[2].Value= false

it is working for me what exception you are encountering?

I am not getting any exception but the checkbox value not unchecked. Is this any problem of adding the one column as Richtextbox control in datagrid when i use the Return it will go to Richtextbox.cs file

Edited 5 Years Ago by bhagawatshinde: n/a

This article has been dead for over six months. Start a new discussion instead.