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
                        }
                        return;

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.

Mitja

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

What is the exception or error you are encountering here?

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.