Click here to Skip to main content
15,919,567 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

I need to update check box value in datagrid.I can do this from an event by clicking cells of datagrid(That is checking or unchecking check box it is working fine).But when reload the window I am setting the values by taking values from database and updating like

dataGridView1.Rows[index].Cells["READ"].Value = 1;


where "READ" is the check box column name.But it is not showing in the window.

Please help me.

Thanks in advance
Posted
Updated 6-Feb-12 0:34am
v2
Comments
manognya kota 6-Feb-12 6:34am    
Added <pre> tags to your code.
Priyadarshini.Thokala 6-Feb-12 7:51am    
May i know that the checked one ur updating in database or not before bindind?

1 solution

Dear Friend,

Try to do it like this:-

dataGridView1.Rows[index].Cells.FormattedValue=1;


As the checkbox value when set then it should be set TRUE or False but when you are setting it to 1 it is not able to map the value but by using the FormattedValue, you are actually setting the value of TRUE which is 1.

Don't forget to mark this as your answer if it helps you out.

Thanks
 
Share this answer
 
Comments
kutz 2 6-Feb-12 7:03am    
Actually I tried with true.still the problem is happening.Also formattedValue is showing error taht we can't assign to
Varun Sareen 7-Feb-12 3:27am    
Dear Pinku,

Please set the Value of the data grid checkbox as 'true' when the value retrived is "1" else 'false'.

Please let me know if it helps

Thanks

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