Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to pass checkbox checked state in datagridview to another form of datagrid?
Posted
Comments
Anupam Shukla 2009 14-Oct-15 9:48am    
Your question is not clear. Please explain what exactly you want to do.
Sathish km 14-Oct-15 10:26am    
in form 1 having grid with checkbox (in checked state). i have to bind whole grid in form 1 into grid in form 2 along with checkbox which are all checked.
Sinisa Hajnal 14-Oct-15 11:31am    
Winform? Just to clear the question: you need to transfer checked rows into second grid? Is form2 grid empty or already contains some data?

If it is empty, I would create collection of rowIDs and in form2 retrieve those rows from the database. Or you could remove the rows from grid1 data source and pass them on to form2 as collection of detached rows and add them in form2.
Sathish km 14-Oct-15 12:39pm    
yes in winform. No all rows to form 2 grid which is usually empty only.

i can able to bind that grid now, my issue is not able to retain the checked state row on grid(form1) to grid(form2).

ex: Form1 grid having 10 rows,assume i checked first 5 rows by checkbox rest of other rows are not checked. I want this checked rows to be checked in form 2 Grid remaining unchecked also to be bind.


am i explained clearly?

Sinisa Hajnal 15-Oct-15 8:16am    
Yes, you have. The solution is a to pass row IDs in a property to Form2 (collection or something) and mark those rows.

Alternative: before binding the grid to datasource in the first form, add field "checked" into the datasource. That way, when you bind it will persist like any other data.

I hope that helps.

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